Module: Broach::Attributes
Overview
Makes a very simple attribute driven model from the class when included.
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *arguments, &block) ⇒ Object
10
11
12
13
14
15
16
|
# File 'lib/broach/attributes.rb', line 10
def method_missing(method, *arguments, &block)
if key = method.to_s and @attributes.has_key?(key)
@attributes[key]
else
super
end
end
|
Instance Method Details
#id ⇒ Object
8
|
# File 'lib/broach/attributes.rb', line 8
def id; @attributes['id']; end
|
#initialize(attributes) ⇒ Object
4
5
6
|
# File 'lib/broach/attributes.rb', line 4
def initialize(attributes)
@attributes = attributes
end
|