diff options
-rw-r--r-- | ramaskrik-program.rb | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/ramaskrik-program.rb b/ramaskrik-program.rb index c485fce..c2ba006 100644 --- a/ramaskrik-program.rb +++ b/ramaskrik-program.rb @@ -21,20 +21,20 @@ require 'room-schedule' require 'uri' class Movie - attr_reader :title, :link, :start_time, :end_time, :venue + attr_reader :title, :link, :start_time, :end_time, :venue - def initialize(node) - @title = node.css("h4").text.strip + def initialize(node) + @title = node.css("h4").text.strip @link = URI.join("https://ramaskrik.no", node.css("h4 a").attribute('href').value) - @start_time = DateTime.parse(node.css(".date").attribute('title').value) - @end_time = DateTime.parse(@start_time.strftime('%F') + node.css(".prgtype-endTime").text.strip.sub(/\w+/, '')) - @end_time += 1 if @end_time < @start_time - @venue = node.css(".place").text.strip - end - - def to_s - "#{title} #{start_time} - #{end_time}, #{venue}" - end + @start_time = DateTime.parse(node.css(".date").attribute('title').value) + @end_time = DateTime.parse(@start_time.strftime('%F') + node.css(".prgtype-endTime").text.strip.sub(/\w+/, '')) + @end_time += 1 if @end_time < @start_time + @venue = node.css(".place").text.strip + end + + def to_s + "#{title} #{start_time} - #{end_time}, #{venue}" + end end doc = Nokogiri::HTML(open("https://ramaskrik.no/program/")) |