Class: Test::Unit::Assertions::AssertionMessage::Template

Class | Test::Unit::Assertions::AssertionMessage::Template
In: | test/unit/assertions.rb
Parent: | Object

### Methods

create new result

### Attributes

count | [R] |

### Public Class methods

create(string)

[Source]

    # File test/unit/assertions.rb, line 401
              def self.create(string)
                parts = (string ? string.scan(/(?=[^\\])\?|(?:\\\?|[^\?])+/m) : [])
                self.new(parts)
              end

new(parts)

[Source]

    # File test/unit/assertions.rb, line 408
              def initialize(parts)
                @parts = parts
                @count = parts.find_all{|e| e == '?'}.size
              end

### Public Instance methods

result(parameters)

[Source]

    # File test/unit/assertions.rb, line 413
              def result(parameters)
                raise "The number of parameters does not match the number of substitutions." if(parameters.size != count)
                params = parameters.dup
                @parts.collect{|e| e == '?' ? params.shift : e.gsub(/\\\?/m, '?')}.join('')
              end

[Validate]