Class: Votigoto::Base
- Inherits:
-
Object
- Object
- Votigoto::Base
- Defined in:
- lib/votigoto/base.rb
Instance Attribute Summary collapse
-
#doc ⇒ Object
readonly
Returns the value of attribute doc.
-
#ip ⇒ Object
readonly
Returns the value of attribute ip.
-
#mak ⇒ Object
readonly
Returns the value of attribute mak.
Instance Method Summary collapse
-
#initialize(ip, mak) ⇒ Base
constructor
A new instance of Base.
- #last_changed_date(reload = false) ⇒ Object
- #show(program_id, reload = false) ⇒ Object
- #shows(reload = false) ⇒ Object (also: #to_a)
Constructor Details
#initialize(ip, mak) ⇒ Base
Returns a new instance of Base.
3 4 5 6 |
# File 'lib/votigoto/base.rb', line 3 def initialize(ip,mak) @ip = ip @mak = mak end |
Instance Attribute Details
#doc ⇒ Object (readonly)
Returns the value of attribute doc.
8 9 10 |
# File 'lib/votigoto/base.rb', line 8 def doc @doc end |
#ip ⇒ Object (readonly)
Returns the value of attribute ip.
8 9 10 |
# File 'lib/votigoto/base.rb', line 8 def ip @ip end |
#mak ⇒ Object (readonly)
Returns the value of attribute mak.
8 9 10 |
# File 'lib/votigoto/base.rb', line 8 def mak @mak end |
Instance Method Details
#last_changed_date(reload = false) ⇒ Object
10 11 12 13 |
# File 'lib/votigoto/base.rb', line 10 def last_changed_date(reload=false) load(reload) Time.at(@doc.at("/tivocontainer/details/lastchangedate").inner_text.to_i(16)) end |
#show(program_id, reload = false) ⇒ Object
26 27 28 29 |
# File 'lib/votigoto/base.rb', line 26 def show(program_id,reload=false) show = shows(reload).select { |show| show.program_id == program_id.to_s } show.length == 1 ? show[0] : nil end |
#shows(reload = false) ⇒ Object Also known as: to_a
15 16 17 18 19 20 21 22 23 |
# File 'lib/votigoto/base.rb', line 15 def shows(reload=false) load(reload) return @shows if @shows @shows = [] @doc.search("tivocontainer/item").each do |show| @shows << Votigoto::Show.new(show) end @shows end |