Class: Foxynews::Presskit
- Inherits:
-
Object
- Object
- Foxynews::Presskit
- Defined in:
- app/services/foxynews/presskit.rb
Instance Method Summary collapse
-
#initialize(args) ⇒ Presskit
constructor
A new instance of Presskit.
- #media_items(limit = 1) ⇒ Object
Constructor Details
#initialize(args) ⇒ Presskit
Returns a new instance of Presskit.
3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'app/services/foxynews/presskit.rb', line 3 def initialize(args) if args.is_a? Hash args.each do |name, value| value.map! {|m| OpenStruct.new(m) } if name == 'media' && value.present? instance_variable_set("@#{name}", value) self.class.send(:attr_accessor, name) end else false end end |
Instance Method Details
#media_items(limit = 1) ⇒ Object
16 17 18 |
# File 'app/services/foxynews/presskit.rb', line 16 def media_items(limit = 1) media.take(limit) end |