Class: JetSet::Attribute
- Inherits:
-
Object
- Object
- JetSet::Attribute
- Defined in:
- lib/jet_set/attribute.rb
Overview
A structure for tracking an entity attribute state.
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#changed?(value) ⇒ Boolean
Returns
trueif the attribute is changed andfalseif it’s not. -
#initialize(name, value) ⇒ Attribute
constructor
Initializes the attribute state.
Constructor Details
#initialize(name, value) ⇒ Attribute
Initializes the attribute state
7 8 9 10 |
# File 'lib/jet_set/attribute.rb', line 7 def initialize(name, value) @name = name @value = value end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/jet_set/attribute.rb', line 4 def name @name end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
4 5 6 |
# File 'lib/jet_set/attribute.rb', line 4 def value @value end |
Instance Method Details
#changed?(value) ⇒ Boolean
Returns true if the attribute is changed and false if it’s not. Parameters:
+value+:: current value to compare.
15 16 17 |
# File 'lib/jet_set/attribute.rb', line 15 def changed?(value) @value != value end |