Class: Omelete::TheaterAgent

Inherits:
Object
  • Object
show all
Defined in:
lib/omelete/theater_agent.rb

Instance Method Summary collapse

Constructor Details

#initialize(omelete_id) ⇒ TheaterAgent

Returns a new instance of TheaterAgent.



11
12
13
14
15
# File 'lib/omelete/theater_agent.rb', line 11

def initialize(omelete_id)
  client = Client.new
  @id = omelete_id
  @page_doc = client.page_doc("cinema/#{@id}")
end

Instance Method Details

#theatersObject



17
18
19
20
21
22
23
24
25
26
# File 'lib/omelete/theater_agent.rb', line 17

def theaters
  theaters = []
  @page_doc.css("div[class='programacao_horarios'] table tr td").each do |td|
    if td.text.match(/^[0-9]{1,}$/)
      @theater = Theater.new td.text
      theaters << @theater
    end
  end
  theaters
end