Class: EnoughFields::AttributeValue

Inherits:
Object
  • Object
show all
Defined in:
lib/enough_fields/attribute_value.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value, klass, field, call_stack) ⇒ AttributeValue

Returns a new instance of AttributeValue.



6
7
8
9
10
11
12
# File 'lib/enough_fields/attribute_value.rb', line 6

def initialize(value, klass, field, call_stack)
  @value = value
  @klass = klass
  @field = field.to_sym
  @call_stack = call_stack
  @used = false
end

Instance Attribute Details

#call_stackObject

Returns the value of attribute call_stack.



3
4
5
# File 'lib/enough_fields/attribute_value.rb', line 3

def call_stack
  @call_stack
end

#fieldObject (readonly)

Returns the value of attribute field.



3
4
5
# File 'lib/enough_fields/attribute_value.rb', line 3

def field
  @field
end

#klassObject (readonly)

Returns the value of attribute klass.



3
4
5
# File 'lib/enough_fields/attribute_value.rb', line 3

def klass
  @klass
end

#used=(value) ⇒ Object (writeonly)

Sets the attribute used

Parameters:

  • value

    the value to set the attribute used to.



4
5
6
# File 'lib/enough_fields/attribute_value.rb', line 4

def used=(value)
  @used = value
end

Instance Method Details

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
25
26
# File 'lib/enough_fields/attribute_value.rb', line 22

def eql?( other )
  self.klass == other.klass &&
  self.field == other.field &&
  self.call_stack == other.call_stack
end

#hashObject



28
29
30
# File 'lib/enough_fields/attribute_value.rb', line 28

def hash
  self.klass.hash + self.field.hash + self.call_stack.hash
end

#to_valueObject



14
15
16
# File 'lib/enough_fields/attribute_value.rb', line 14

def to_value
  @value
end

#used?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/enough_fields/attribute_value.rb', line 18

def used?
  @used == true
end