Class: GamesRadar::Screenshot
- Inherits:
-
Object
- Object
- GamesRadar::Screenshot
- Defined in:
- lib/games_radar/screenshot.rb
Instance Attribute Summary collapse
-
#image ⇒ Object
readonly
The large image url.
-
#published_at ⇒ Object
readonly
When the screenshot was published on GamesRadar.
-
#thumbnail ⇒ Object
readonly
The thumbnail url.
-
#url ⇒ Object
readonly
The screenshot page on GamesRadar.
Class Method Summary collapse
-
.initialize_with_node(node) ⇒ Object
:nodoc:.
Instance Method Summary collapse
-
#initialize(attrs = {}) ⇒ Screenshot
constructor
Initialize a new screenshot object and set the hash to its attributes.
Constructor Details
#initialize(attrs = {}) ⇒ Screenshot
Initialize a new screenshot object and set the hash to its attributes.
GamesRadar::Screenshot.new(
:url => "/some/url",
:image => "/some/image.jpg"
)
35 36 37 38 39 |
# File 'lib/games_radar/screenshot.rb', line 35 def initialize(attrs = {}) attrs.each do |name, value| instance_variable_set("@#{name}", value) end end |
Instance Attribute Details
#image ⇒ Object (readonly)
The large image url
10 11 12 |
# File 'lib/games_radar/screenshot.rb', line 10 def image @image end |
#published_at ⇒ Object (readonly)
When the screenshot was published on GamesRadar
13 14 15 |
# File 'lib/games_radar/screenshot.rb', line 13 def published_at @published_at end |
#thumbnail ⇒ Object (readonly)
The thumbnail url
7 8 9 |
# File 'lib/games_radar/screenshot.rb', line 7 def thumbnail @thumbnail end |
#url ⇒ Object (readonly)
The screenshot page on GamesRadar
4 5 6 |
# File 'lib/games_radar/screenshot.rb', line 4 def url @url end |
Class Method Details
.initialize_with_node(node) ⇒ Object
:nodoc:
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/games_radar/screenshot.rb', line 15 def self.initialize_with_node(node) # :nodoc: thumbnail = node.at("thumbnail").text image = thumbnail.gsub(/screenshot_small\.jpg/, "screenshot_viewer_medium.jpg") new( { :url => node.at("url").text, :thumbnail => thumbnail, :image => image, :published_at => Time.parse(node.at("published_date").text) } ) end |