Class: UpcomingMoviesInThePark::Park
- Inherits:
-
Object
- Object
- UpcomingMoviesInThePark::Park
- Defined in:
- lib/upcoming_movies_in_the_park/park.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#showings ⇒ Object
Returns the value of attribute showings.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name) ⇒ Park
constructor
A new instance of Park.
Methods included from Super::GateParkInstanceMethods
Methods included from Super::InstanceMethods
Constructor Details
#initialize(name) ⇒ Park
Returns a new instance of Park.
13 14 15 16 17 |
# File 'lib/upcoming_movies_in_the_park/park.rb', line 13 def initialize(name) @name = name @showings =[] self.save end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
2 3 4 |
# File 'lib/upcoming_movies_in_the_park/park.rb', line 2 def name @name end |
#showings ⇒ Object
Returns the value of attribute showings.
2 3 4 |
# File 'lib/upcoming_movies_in_the_park/park.rb', line 2 def showings @showings end |
Class Method Details
.all ⇒ Object
9 10 11 |
# File 'lib/upcoming_movies_in_the_park/park.rb', line 9 def self.all @@all end |
.find_or_create_by_name(name) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/upcoming_movies_in_the_park/park.rb', line 19 def self.find_or_create_by_name(name) if @@all.any? {|park| park.name == name} @@all.find {|park| park.name == name} else park_1 = self.new(name) end end |
.list_by_name ⇒ Object
28 29 30 31 |
# File 'lib/upcoming_movies_in_the_park/park.rb', line 28 def self.list_by_name self.all.each_with_index {|park, i| puts "#{i +1}. #{park.name}".colorize(:green)} end |