Class: JsonRspecMatchMaker::TargetValue
- Inherits:
-
Object
- Object
- JsonRspecMatchMaker::TargetValue
- Defined in:
- lib/json_rspec_match_maker/target_value.rb
Overview
Handles fetching the target value from the target object
Constant Summary collapse
- NUMBER =
/^\d+$/
Instance Attribute Summary collapse
-
#error_key ⇒ Object
readonly
Returns the value of attribute error_key.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(key, target) ⇒ TargetValue
constructor
A new instance of TargetValue.
Constructor Details
#initialize(key, target) ⇒ TargetValue
Returns a new instance of TargetValue.
8 9 10 11 |
# File 'lib/json_rspec_match_maker/target_value.rb', line 8 def initialize(key, target) @error_key = key @value = value_for_key(key, target) end |
Instance Attribute Details
#error_key ⇒ Object (readonly)
Returns the value of attribute error_key.
4 5 6 |
# File 'lib/json_rspec_match_maker/target_value.rb', line 4 def error_key @error_key end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
4 5 6 |
# File 'lib/json_rspec_match_maker/target_value.rb', line 4 def value @value end |
Instance Method Details
#==(other) ⇒ Object
13 14 15 16 |
# File 'lib/json_rspec_match_maker/target_value.rb', line 13 def ==(other) raise ArgumentError unless other.is_a? ExpectedValue other.value == value end |