Class: OrlandoEvents::Event
- Inherits:
-
Object
- Object
- OrlandoEvents::Event
- Defined in:
- lib/orlando_events/event.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#events ⇒ Object
Returns the value of attribute events.
-
#month_url ⇒ Object
Returns the value of attribute month_url.
-
#name ⇒ Object
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
- #add_event_details(events_array) ⇒ Object
- #add_events(month_events) ⇒ Object
-
#initialize(month_hash) ⇒ Event
constructor
A new instance of Event.
Constructor Details
#initialize(month_hash) ⇒ Event
Returns a new instance of Event.
6 7 8 9 10 11 12 |
# File 'lib/orlando_events/event.rb', line 6 def initialize(month_hash) @events = [] month_hash.each do |k,v| self.send "#{k}=", v end @@all << self end |
Instance Attribute Details
#events ⇒ Object
Returns the value of attribute events.
2 3 4 |
# File 'lib/orlando_events/event.rb', line 2 def events @events end |
#month_url ⇒ Object
Returns the value of attribute month_url.
2 3 4 |
# File 'lib/orlando_events/event.rb', line 2 def month_url @month_url end |
#name ⇒ Object
Returns the value of attribute name.
2 3 4 |
# File 'lib/orlando_events/event.rb', line 2 def name @name end |
Class Method Details
.all ⇒ Object
34 35 36 |
# File 'lib/orlando_events/event.rb', line 34 def self.all @@all end |
.create_from_collection(months_array) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/orlando_events/event.rb', line 14 def self.create_from_collection(months_array) months_array.each do |month| self.new(month) # binding.pry end end |
Instance Method Details
#add_event_details(events_array) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/orlando_events/event.rb', line 21 def add_event_details(events_array) events_array.each do |event_hash| OrlandoEvents::MonthEvents.new(event_hash, self) end self end |
#add_events(month_events) ⇒ Object
28 29 30 31 32 |
# File 'lib/orlando_events/event.rb', line 28 def add_events(month_events) month_events.month = self if !month_events.month @events << month_events # binding.pry end |