Class: Models::UserInfo
- Inherits:
-
Object
- Object
- Models::UserInfo
- Defined in:
- lib/models/user_info.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Instance Method Summary collapse
- #as_json ⇒ Object
-
#initialize(args) ⇒ UserInfo
constructor
A new instance of UserInfo.
Constructor Details
#initialize(args) ⇒ UserInfo
Returns a new instance of UserInfo.
4 5 6 7 8 9 10 11 12 |
# File 'lib/models/user_info.rb', line 4 def initialize(args) @attributes = [] args.each do |key, value| @attributes << key define_singleton_method(key) do value end end end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
3 4 5 |
# File 'lib/models/user_info.rb', line 3 def attributes @attributes end |
Instance Method Details
#as_json ⇒ Object
14 15 16 17 18 |
# File 'lib/models/user_info.rb', line 14 def as_json @attributes.each_with_object({}) do |attr_name, hsh| hsh[attr_name.to_s] = public_send attr_name end end |