Class: Yify::Models::Base
- Inherits:
-
Object
- Object
- Yify::Models::Base
- Includes:
- Support::Utils
- Defined in:
- lib/yify/models/base.rb
Direct Known Subclasses
Actor, ApiResponse, Bookmark, Comment, Director, Movie, ParentalGuide, Profile, Review, Session, Torrent, User
Instance Method Summary collapse
-
#initialize(params) ⇒ Base
constructor
A new instance of Base.
Methods included from Support::Utils
#map_class, #post_params, #symbolize_keys
Constructor Details
#initialize(params) ⇒ Base
Returns a new instance of Base.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/yify/models/base.rb', line 9 def initialize(params) self.extend(Virtus.model) params.each do |key, value| klass = map_class(key) begin Yify::Models.const_get klass.to_s.classify attribute key, Array[Yify::Models.const_get klass.to_s.classify] rescue attribute key, value.class end self[key] = value end end |