Class: Rockstar::Chart

Inherits:
Base
  • Object
show all
Defined in:
lib/rockstar/chart.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

connection, fetch_and_parse, get_instance

Constructor Details

#initialize(from, to) ⇒ Chart

Returns a new instance of Chart.

Raises:

  • (ArgumentError)


8
9
10
11
12
13
# File 'lib/rockstar/chart.rb', line 8

def initialize(from, to)
  raise ArgumentError, "From is required" if from.blank?
  raise ArgumentError, "To is required" if to.blank?
  @from = from
  @to = to
end

Class Method Details

.new_from_xml(xml, doc) ⇒ Object



4
5
6
# File 'lib/rockstar/chart.rb', line 4

def new_from_xml(xml, doc)
  Chart.new(xml['from'], xml['to'])
end

Instance Method Details

#fromObject



23
24
25
# File 'lib/rockstar/chart.rb', line 23

def from
  @from.to_i
end

#from=(value) ⇒ Object



15
16
17
# File 'lib/rockstar/chart.rb', line 15

def from=(value)
  @from = value.to_i
end

#toObject



27
28
29
# File 'lib/rockstar/chart.rb', line 27

def to
  @to.to_i
end

#to=(value) ⇒ Object



19
20
21
# File 'lib/rockstar/chart.rb', line 19

def to=(value)
  @to = value.to_i
end