Class: SmoothOperator::InternalAttribute
- Inherits:
-
Object
- Object
- SmoothOperator::InternalAttribute
- Defined in:
- lib/smooth_operator/internal_attribute.rb
Instance Attribute Summary collapse
-
#first_value ⇒ Object
readonly
Returns the value of attribute first_value.
-
#original_name ⇒ Object
readonly
Returns the value of attribute original_name.
-
#original_value ⇒ Object
readonly
Returns the value of attribute original_value.
-
#turn_unknown_hash_to_open_struct ⇒ Object
readonly
Returns the value of attribute turn_unknown_hash_to_open_struct.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #changed? ⇒ Boolean
-
#initialize(name, value, type, turn_to_open_struct = nil) ⇒ InternalAttribute
constructor
A new instance of InternalAttribute.
- #set_value(new_value) ⇒ Object
- #was ⇒ Object
Constructor Details
#initialize(name, value, type, turn_to_open_struct = nil) ⇒ InternalAttribute
Returns a new instance of InternalAttribute.
9 10 11 12 13 14 15 |
# File 'lib/smooth_operator/internal_attribute.rb', line 9 def initialize(name, value, type, turn_to_open_struct = nil) @original_name, @original_value, @type = name, value, type @turn_unknown_hash_to_open_struct = turn_to_open_struct.nil? ? true : turn_to_open_struct @first_value = set_value(value) end |
Instance Attribute Details
#first_value ⇒ Object (readonly)
Returns the value of attribute first_value.
7 8 9 |
# File 'lib/smooth_operator/internal_attribute.rb', line 7 def first_value @first_value end |
#original_name ⇒ Object (readonly)
Returns the value of attribute original_name.
7 8 9 |
# File 'lib/smooth_operator/internal_attribute.rb', line 7 def original_name @original_name end |
#original_value ⇒ Object (readonly)
Returns the value of attribute original_value.
7 8 9 |
# File 'lib/smooth_operator/internal_attribute.rb', line 7 def original_value @original_value end |
#turn_unknown_hash_to_open_struct ⇒ Object (readonly)
Returns the value of attribute turn_unknown_hash_to_open_struct.
7 8 9 |
# File 'lib/smooth_operator/internal_attribute.rb', line 7 def turn_unknown_hash_to_open_struct @turn_unknown_hash_to_open_struct end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
7 8 9 |
# File 'lib/smooth_operator/internal_attribute.rb', line 7 def type @type end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
7 8 9 |
# File 'lib/smooth_operator/internal_attribute.rb', line 7 def value @value end |
Instance Method Details
#changed? ⇒ Boolean
21 22 23 |
# File 'lib/smooth_operator/internal_attribute.rb', line 21 def changed? @first_value != @value end |
#set_value(new_value) ⇒ Object
17 18 19 |
# File 'lib/smooth_operator/internal_attribute.rb', line 17 def set_value(new_value) @value = cast_to_type(new_value) end |
#was ⇒ Object
25 26 27 |
# File 'lib/smooth_operator/internal_attribute.rb', line 25 def was @first_value end |