Class: Articles
- Inherits:
-
Object
- Object
- Articles
- Defined in:
- lib/api/utils/articles.rb
Overview
This class is used to store the data for web articles.
Instance Attribute Summary collapse
-
#articles ⇒ Object
readonly
Returns the value of attribute articles.
Instance Method Summary collapse
-
#initialize(hash) ⇒ Articles
constructor
A new instance of Articles.
Constructor Details
#initialize(hash) ⇒ Articles
Returns a new instance of Articles.
8 9 10 11 12 13 |
# File 'lib/api/utils/articles.rb', line 8 def initialize(hash) data = hash['data'] @articles = data.each_with_object([]) do |article, arr| arr << Article.new(article) end end |
Instance Attribute Details
#articles ⇒ Object (readonly)
Returns the value of attribute articles.
6 7 8 |
# File 'lib/api/utils/articles.rb', line 6 def articles @articles end |