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.
10 11 12 13 |
# File 'lib/json_rspec_match_maker/target_value.rb', line 10 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.
6 7 8 |
# File 'lib/json_rspec_match_maker/target_value.rb', line 6 def error_key @error_key end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
6 7 8 |
# File 'lib/json_rspec_match_maker/target_value.rb', line 6 def value @value end |
Instance Method Details
#==(other) ⇒ Object
15 16 17 18 |
# File 'lib/json_rspec_match_maker/target_value.rb', line 15 def ==(other) raise ArgumentError unless other.is_a? ExpectedValue other.value == value end |