Class: Writer::Fetcher::Microdata::Twitter::ArticleSmall
- Inherits:
-
Object
- Object
- Writer::Fetcher::Microdata::Twitter::ArticleSmall
- Defined in:
- lib/writer/fetcher/microdata/twitter/article_small.rb
Instance Attribute Summary collapse
-
#source ⇒ Object
Returns the value of attribute source.
Instance Method Summary collapse
- #hash ⇒ Object
-
#initialize(the_source) ⇒ ArticleSmall
constructor
A new instance of ArticleSmall.
Constructor Details
#initialize(the_source) ⇒ ArticleSmall
Returns a new instance of ArticleSmall.
8 9 10 |
# File 'lib/writer/fetcher/microdata/twitter/article_small.rb', line 8 def initialize the_source @source = the_source end |
Instance Attribute Details
#source ⇒ Object
Returns the value of attribute source.
6 7 8 |
# File 'lib/writer/fetcher/microdata/twitter/article_small.rb', line 6 def source @source end |
Instance Method Details
#hash ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/writer/fetcher/microdata/twitter/article_small.rb', line 12 def hash @attributes = @source.attributes { "type" => [@source._type], "properties" => { "additionalType" => [ @attributes[:additionalType] ], "Item#id" => [ @attributes[:id] ], "articleBody" => [ @attributes[:articleBody] ], "author" => [ @attributes[:author].to.hash ], "Item#viewer" => [ @attributes[:viewer].to.hash ], "dateCreated" => [ @attributes[:dateCreated] ], "provider" => @attributes[:provider], "url" => [ @attributes[:url] ] } } end |