Class: Articles

Inherits:
Object
  • Object
show all
Defined in:
lib/api/utils/articles.rb

Overview

This class is used to store the data for web articles.

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#articlesObject (readonly)

Returns the value of attribute articles.



6
7
8
# File 'lib/api/utils/articles.rb', line 6

def articles
  @articles
end