Class: Cinebase::Cinema
- Inherits:
-
Object
- Object
- Cinebase::Cinema
- Defined in:
- lib/cinebase/cinema.rb
Overview
Cinema base class
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Class Method Summary collapse
Instance Method Summary collapse
- #address ⇒ Object
- #adr ⇒ Object
- #country_name ⇒ Object
- #extended_address ⇒ Object
- #full_name ⇒ Object
-
#initialize(id) ⇒ Cinema
constructor
A new instance of Cinema.
- #locality ⇒ Object
- #postal_code ⇒ Object
- #region ⇒ Object
- #slug ⇒ Object
- #street_address ⇒ Object
Constructor Details
#initialize(id) ⇒ Cinema
Returns a new instance of Cinema.
6 7 8 |
# File 'lib/cinebase/cinema.rb', line 6 def initialize(id) @id = id end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
4 5 6 |
# File 'lib/cinebase/cinema.rb', line 4 def id @id end |
Class Method Details
.all ⇒ Object
10 11 12 |
# File 'lib/cinebase/cinema.rb', line 10 def self.all fail NotImplementedError, "This #{self.class} cannot respond to: " end |
Instance Method Details
#address ⇒ Object
25 26 27 |
# File 'lib/cinebase/cinema.rb', line 25 def address adr end |
#adr ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/cinebase/cinema.rb', line 14 def adr { street_address: nil, extended_address: nil, locality: nil, region: nil, postal_code: nil, country_name: nil } end |
#country_name ⇒ Object
29 30 31 |
# File 'lib/cinebase/cinema.rb', line 29 def country_name adr[:country_name].to_s end |
#extended_address ⇒ Object
33 34 35 |
# File 'lib/cinebase/cinema.rb', line 33 def extended_address adr[:extended_address].to_s end |
#full_name ⇒ Object
37 38 39 |
# File 'lib/cinebase/cinema.rb', line 37 def full_name @full_name ||= "#{brand} #{name}" end |
#locality ⇒ Object
41 42 43 |
# File 'lib/cinebase/cinema.rb', line 41 def locality adr[:locality].to_s end |
#postal_code ⇒ Object
45 46 47 |
# File 'lib/cinebase/cinema.rb', line 45 def postal_code adr[:postal_code].to_s end |
#region ⇒ Object
49 50 51 |
# File 'lib/cinebase/cinema.rb', line 49 def region adr[:region].to_s end |
#slug ⇒ Object
53 54 55 |
# File 'lib/cinebase/cinema.rb', line 53 def slug @slug ||= full_name.downcase.gsub(/[^0-9a-z ]/, '').gsub(/\s+/, '-') end |
#street_address ⇒ Object
57 58 59 |
# File 'lib/cinebase/cinema.rb', line 57 def street_address adr[:street_address].to_s end |