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.
10 11 12 13 14 15 16 17 18 |
# File 'lib/cinebase/performance.rb', line 10 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.
4 5 6 |
# File 'lib/cinebase/performance.rb', line 4 def booking_url @booking_url end |
#cinema_id ⇒ Object (readonly)
Returns the value of attribute cinema_id.
6 7 8 |
# File 'lib/cinebase/performance.rb', line 6 def cinema_id @cinema_id end |
#cinema_name ⇒ Object (readonly)
Returns the value of attribute cinema_name.
7 8 9 |
# File 'lib/cinebase/performance.rb', line 7 def cinema_name @cinema_name end |
#dimension ⇒ Object (readonly)
Returns the value of attribute dimension.
5 6 7 |
# File 'lib/cinebase/performance.rb', line 5 def dimension @dimension end |
#film_name ⇒ Object (readonly)
Returns the value of attribute film_name.
8 9 10 |
# File 'lib/cinebase/performance.rb', line 8 def film_name @film_name end |
Class Method Details
.at(cinema_id) ⇒ Object
Implement to deliver an Array of Screening objects
21 22 23 |
# File 'lib/cinebase/performance.rb', line 21 def self.at(cinema_id) fail NotImplementedError, "This #{self.class} cannot respond to: " end |
Instance Method Details
#showing_on ⇒ Object
34 35 36 |
# File 'lib/cinebase/performance.rb', line 34 def showing_on starting_at.to_date end |
#starting_at ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/cinebase/performance.rb', line 25 def starting_at @starting_at ||= if @time.utc? @time else TZInfo::Timezone.get('Europe/London').local_to_utc(@time) end end |
#variant ⇒ Object
38 39 40 41 |
# File 'lib/cinebase/performance.rb', line 38 def variant @variant = @variant.split(' ') if @variant.is_a?(String) @variant.map(&:downcase).sort.uniq end |