Class: PrizePicks::Api::Responses::User
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- PrizePicks::Api::Responses::User
- Defined in:
- lib/prizepicks/api/responses/user.rb
Instance Method Summary collapse
-
#initialize(attributes) ⇒ User
constructor
A new instance of User.
- #to_obstruct(_attributes) ⇒ Object
Constructor Details
#initialize(attributes) ⇒ User
Returns a new instance of User.
6 7 8 |
# File 'lib/prizepicks/api/responses/user.rb', line 6 def initialize(attributes) super to_obstruct(attributes) end |
Instance Method Details
#to_obstruct(_attributes) ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/prizepicks/api/responses/user.rb', line 10 def to_obstruct(_attributes) case obj when Hash OpenStruct.new(obj.transform_values { |val| to_obstruct(val) }) when Array obj.map { |o| to_obstruct(o) } else obj end end |