Class: BroadwayNow::Show

Inherits:
Object
  • Object
show all
Defined in:
lib/broadway_now/show.rb

Constant Summary collapse

@@all =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash_attributes) ⇒ Show

Returns a new instance of Show.



5
6
7
# File 'lib/broadway_now/show.rb', line 5

def initialize(hash_attributes)
  hash_attributes.each {|key,value| self.send(("#{key}="), value)} 
end

Instance Attribute Details

#nameObject

, :cast



2
3
4
# File 'lib/broadway_now/show.rb', line 2

def name
  @name
end

#priceObject

, :cast



2
3
4
# File 'lib/broadway_now/show.rb', line 2

def price
  @price
end

#running_timeObject

, :cast



2
3
4
# File 'lib/broadway_now/show.rb', line 2

def running_time
  @running_time
end

#storyObject

, :cast



2
3
4
# File 'lib/broadway_now/show.rb', line 2

def story
  @story
end

#theaterObject

, :cast



2
3
4
# File 'lib/broadway_now/show.rb', line 2

def theater
  @theater
end

#urlObject

, :cast



2
3
4
# File 'lib/broadway_now/show.rb', line 2

def url
  @url
end

Class Method Details

.allObject



20
21
22
# File 'lib/broadway_now/show.rb', line 20

def self.all
  @@all
end

.create_shows(shows_array) ⇒ Object



9
10
11
12
13
14
# File 'lib/broadway_now/show.rb', line 9

def self.create_shows(shows_array)
  shows_array.each do |hash_attributes|
    show = self.new(hash_attributes)
    @@all << show
  end
end

Instance Method Details

#add_info(extra_info_hash) ⇒ Object



16
17
18
# File 'lib/broadway_now/show.rb', line 16

def add_info(extra_info_hash) 
  extra_info_hash.each {|key,value| self.send(("#{key}="),value)}
end