Class: Cinebase::Performance
- Inherits:
-
Object
- Object
- Cinebase::Performance
- Defined in:
- lib/cinebase/performance.rb
Overview
Performance base class
Instance Attribute Summary collapse
-
#booking_url ⇒ Object
readonly
Returns the value of attribute booking_url.
-
#cinema_id ⇒ Object
readonly
Returns the value of attribute cinema_id.
-
#cinema_name ⇒ Object
readonly
Returns the value of attribute cinema_name.
-
#dimension ⇒ Object
readonly
Returns the value of attribute dimension.
-
#film_name ⇒ Object
readonly
Returns the value of attribute film_name.
Class Method Summary collapse
-
.at(cinema_id) ⇒ Object
Implement to deliver an Array of Screening objects.
Instance Method Summary collapse
-
#initialize(options) ⇒ Performance
constructor
A new instance of Performance.
- #showing_on ⇒ Object
- #starting_at ⇒ Object
- #variant ⇒ Object
Constructor Details
#initialize(options) ⇒ Performance
Returns a new instance of Performance.
12 13 14 15 16 17 18 19 20 |
# File 'lib/cinebase/performance.rb', line 12 def initialize() @booking_url = .fetch(:booking_url, nil) @cinema_name = .fetch(:cinema_name) @cinema_id = .fetch(:cinema_id) @dimension = .fetch(:dimension, '2d') @film_name = .fetch(:film_name) @time = .fetch(:starting_at) @variant = .fetch(:variant, []) end |
Instance Attribute Details
#booking_url ⇒ Object (readonly)
Returns the value of attribute booking_url.
6 7 8 |
# File 'lib/cinebase/performance.rb', line 6 def booking_url @booking_url end |
#cinema_id ⇒ Object (readonly)
Returns the value of attribute cinema_id.
8 9 10 |
# File 'lib/cinebase/performance.rb', line 8 def cinema_id @cinema_id end |
#cinema_name ⇒ Object (readonly)
Returns the value of attribute cinema_name.
9 10 11 |
# File 'lib/cinebase/performance.rb', line 9 def cinema_name @cinema_name end |
#dimension ⇒ Object (readonly)
Returns the value of attribute dimension.
7 8 9 |
# File 'lib/cinebase/performance.rb', line 7 def dimension @dimension end |
#film_name ⇒ Object (readonly)
Returns the value of attribute film_name.
10 11 12 |
# File 'lib/cinebase/performance.rb', line 10 def film_name @film_name end |
Class Method Details
.at(cinema_id) ⇒ Object
Implement to deliver an Array of Screening objects
23 24 25 |
# File 'lib/cinebase/performance.rb', line 23 def self.at(cinema_id) fail NotImplementedError, "This #{self.class} cannot respond to: " end |
Instance Method Details
#showing_on ⇒ Object
36 37 38 |
# File 'lib/cinebase/performance.rb', line 36 def showing_on starting_at.to_date end |
#starting_at ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/cinebase/performance.rb', line 27 def starting_at @starting_at ||= if @time.utc? @time else TZInfo::Timezone.get('Europe/London').local_to_utc(@time) end end |
#variant ⇒ Object
40 41 42 43 |
# File 'lib/cinebase/performance.rb', line 40 def variant @variant = @variant.split(' ') if @variant.is_a?(String) @variant.map(&:downcase).sort.uniq end |