Class: Opto::Model::Attribute

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(collection, definition, handler) ⇒ Attribute

Returns a new instance of Attribute.



9
10
11
12
13
14
# File 'lib/opto/model/attribute.rb', line 9

def initialize(collection, definition, handler)
  @collection = collection
  @definition = definition
  @handler    = handler
  @name = definition[:name]
end

Instance Attribute Details

#collectionObject (readonly)

Returns the value of attribute collection.



5
6
7
# File 'lib/opto/model/attribute.rb', line 5

def collection
  @collection
end

#definitionObject (readonly)

Returns the value of attribute definition.



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

def definition
  @definition
end

#handlerObject (readonly)

Returns the value of attribute handler.



6
7
8
# File 'lib/opto/model/attribute.rb', line 6

def handler
  @handler
end

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/opto/model/attribute.rb', line 7

def name
  @name
end

Instance Method Details

#set(value) ⇒ Object



16
17
18
# File 'lib/opto/model/attribute.rb', line 16

def set(value)
  handler.set(value)
end

#valueObject



20
21
22
# File 'lib/opto/model/attribute.rb', line 20

def value
  handler.value
end