class PicturehouseUk::Internal::Showtime

@api private parse an individual screening node

Public Class Methods

new(node, date) click to toggle source
# File lib/picturehouse_uk/internal/parser/screenings.rb, line 133
def initialize(node, date)
  @node = node
  @date = date
end

Public Instance Methods

to_hash() click to toggle source
# File lib/picturehouse_uk/internal/parser/screenings.rb, line 138
def to_hash
  {
    booking_url: booking_url,
    starting_at: starting_at
  }
end

Private Instance Methods

booking_url() click to toggle source
# File lib/picturehouse_uk/internal/parser/screenings.rb, line 147
def booking_url
  return if href.nil? || href.empty?
  "https://picturehouses.com#{href}"
end
hour() click to toggle source
# File lib/picturehouse_uk/internal/parser/screenings.rb, line 152
def hour
  split[0]
end
href() click to toggle source
# File lib/picturehouse_uk/internal/parser/screenings.rb, line 156
def href
  @href ||= @node['href']
end
min() click to toggle source
# File lib/picturehouse_uk/internal/parser/screenings.rb, line 160
def min
  split[1]
end
split() click to toggle source
# File lib/picturehouse_uk/internal/parser/screenings.rb, line 164
def split
  @split ||= @node.text.split('.').map(&:to_i)
end
starting_at() click to toggle source
# File lib/picturehouse_uk/internal/parser/screenings.rb, line 168
def starting_at
  @starting_at ||= @date.to_time + (hour * 60 + min) * 60
end