Class: UpcomingMoviesInThePark::Showing
- Inherits:
-
Object
- Object
- UpcomingMoviesInThePark::Showing
- Defined in:
- lib/upcoming_movies_in_the_park/showing.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#date ⇒ Object
Returns the value of attribute date.
-
#name ⇒ Object
Returns the value of attribute name.
-
#park ⇒ Object
Returns the value of attribute park.
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
Methods included from UpcomingMoviesInThePark::Super::InstanceMethods
Instance Attribute Details
#date ⇒ Object
Returns the value of attribute date.
5 6 7 |
# File 'lib/upcoming_movies_in_the_park/showing.rb', line 5 def date @date end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/upcoming_movies_in_the_park/showing.rb', line 4 def name @name end |
#park ⇒ Object
Returns the value of attribute park.
5 6 7 |
# File 'lib/upcoming_movies_in_the_park/showing.rb', line 5 def park @park end |
#url ⇒ Object
Returns the value of attribute url.
4 5 6 |
# File 'lib/upcoming_movies_in_the_park/showing.rb', line 4 def url @url end |
Class Method Details
.all ⇒ Object
9 10 11 |
# File 'lib/upcoming_movies_in_the_park/showing.rb', line 9 def self.all @@all end |
.create_from_hash(hash) ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/upcoming_movies_in_the_park/showing.rb', line 38 def self.create_from_hash(hash) thing = UpcomingMoviesInThePark::Showing.new hash.each do |k,v| thing.send("#{k}=", v) end @@all<<thing end |
.list_by_name ⇒ Object
13 14 15 16 |
# File 'lib/upcoming_movies_in_the_park/showing.rb', line 13 def self.list_by_name self.all.each_with_index {|showing, i| puts "#{i +1}. #{showing.name}".colorize(:green)} end |
Instance Method Details
#display_details ⇒ Object
18 19 20 21 |
# File 'lib/upcoming_movies_in_the_park/showing.rb', line 18 def display_details puts "#{@name} is playing from #{self.time}".colorize(:red) puts "on #{@date.month} #{@date.day}, #{@date.year} in #{@park.name}.".colorize(:red) end |
#time ⇒ Object
23 24 25 26 |
# File 'lib/upcoming_movies_in_the_park/showing.rb', line 23 def time data = self.date.name.split(/, | |\n/) time = "#{data[37]} #{data[38]} to #{data[40]} #{data[41]}" end |