Class: Rhapsody::Member
- Inherits:
-
Object
- Object
- Rhapsody::Member
- Defined in:
- lib/rhapsody/models/member.rb
Instance Attribute Summary collapse
-
#attr_list ⇒ Object
Returns the value of attribute attr_list.
Class Method Summary collapse
-
.define_attr_accessor(key) ⇒ Object
TODO: This needs to be global / base.
- .to_camelcase(key) ⇒ Object
Instance Method Summary collapse
-
#initialize(options) ⇒ Member
constructor
A new instance of Member.
Constructor Details
#initialize(options) ⇒ Member
Returns a new instance of Member.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/rhapsody/models/member.rb', line 17 def initialize() if self.attr_list = [] .each do |key, value| key = Rhapsody::Member.to_camelcase(key) # Set attr_accessor dynamically Rhapsody::Member.define_attr_accessor(key) self.attr_list << key # Set value for the attribute send("#{key}=", value) end end end |
Instance Attribute Details
#attr_list ⇒ Object
Returns the value of attribute attr_list.
4 5 6 |
# File 'lib/rhapsody/models/member.rb', line 4 def attr_list @attr_list end |
Class Method Details
.define_attr_accessor(key) ⇒ Object
TODO: This needs to be global / base
8 9 10 |
# File 'lib/rhapsody/models/member.rb', line 8 def define_attr_accessor(key) __send__(:attr_accessor, key) end |
.to_camelcase(key) ⇒ Object
12 13 14 |
# File 'lib/rhapsody/models/member.rb', line 12 def to_camelcase(key) key.to_s.underscore end |