Class: AttrObject::Manager

Inherits:
Object
  • Object
show all
Defined in:
lib/attr_object/manager.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeManager

Returns a new instance of Manager.



5
6
7
# File 'lib/attr_object/manager.rb', line 5

def initialize
  @attributes = {}
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



3
4
5
# File 'lib/attr_object/manager.rb', line 3

def attributes
  @attributes
end

Instance Method Details

#get(attribute) ⇒ Object



13
14
15
16
# File 'lib/attr_object/manager.rb', line 13

def get attribute
  return if @attributes[attribute].nil?
  @attributes[attribute].cast
end

#set(klass, attribute, value) ⇒ Object



9
10
11
# File 'lib/attr_object/manager.rb', line 9

def set klass, attribute, value
  @attributes[attribute] = Value.new klass, value
end