Exception: MustBe::PairNote

Inherits:
ContainerNote show all
Defined in:
lib/must_be/containers.rb

Instance Attribute Summary collapse

Attributes inherited from ContainerNote

#container, #original_note

Attributes inherited from Note

#additional_message, #args, #assertion, #block, #prefix, #receiver

Instance Method Summary collapse

Methods inherited from ContainerNote

#backtrace, #regular_backtrace

Methods inherited from Note

#backtrace, #complete_backtrace

Constructor Details

#initialize(key, value, cases, container, negate) ⇒ PairNote

Returns a new instance of PairNote.



48
49
50
51
52
53
54
# File 'lib/must_be/containers.rb', line 48

def initialize(key, value, cases, container, negate)
  super(Note.new(""), container)
  @key = key
  @value = value
  @cases = cases
  @negate = negate
end

Instance Attribute Details

#casesObject

Returns the value of attribute cases.



46
47
48
# File 'lib/must_be/containers.rb', line 46

def cases
  @cases
end

#keyObject

Returns the value of attribute key.



46
47
48
# File 'lib/must_be/containers.rb', line 46

def key
  @key
end

#negateObject

Returns the value of attribute negate.



46
47
48
# File 'lib/must_be/containers.rb', line 46

def negate
  @negate
end

#valueObject

Returns the value of attribute value.



46
47
48
# File 'lib/must_be/containers.rb', line 46

def value
  @value
end

Instance Method Details

#to_sObject



56
57
58
59
60
61
62
# File 'lib/must_be/containers.rb', line 56

def to_s
  match = negate ? "matches" : "does not match"
  "#{prefix}pair {#{MustBe.short_inspect(key)}=>"\
    "#{MustBe.short_inspect(value)}} #{match}"\
    " #{MustBe.short_inspect(cases)} in"\
    " container #{MustBe.short_inspect(container)}"
end