Class: JetSet::Attribute

Inherits:
Object
  • Object
show all
Defined in:
lib/jet_set/attribute.rb

Overview

A structure for tracking an entity attribute state.

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/jet_set/attribute.rb', line 4

def name
  @name
end

#valueObject (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.

Returns:

  • (Boolean)


15
16
17
# File 'lib/jet_set/attribute.rb', line 15

def changed?(value)
  @value != value
end