Class: SdEvents::Events
- Inherits:
-
Object
- Object
- SdEvents::Events
- Defined in:
- lib/sd_events/events.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#category ⇒ Object
Returns the value of attribute category.
-
#location ⇒ Object
Returns the value of attribute location.
-
#name ⇒ Object
Returns the value of attribute name.
-
#time ⇒ Object
Returns the value of attribute time.
-
#venue ⇒ Object
Returns the value of attribute venue.
Class Method Summary collapse
- .all ⇒ Object
- .clear ⇒ Object
-
.create_daypart(event_time) ⇒ Object
> “afternoon”.
- .empty? ⇒ Boolean
- .find(id) ⇒ Object
Instance Method Summary collapse
-
#initialize ⇒ Events
constructor
A new instance of Events.
Constructor Details
#initialize ⇒ Events
Returns a new instance of Events.
5 6 7 |
# File 'lib/sd_events/events.rb', line 5 def initialize @@all << self end |
Instance Attribute Details
#category ⇒ Object
Returns the value of attribute category.
2 3 4 |
# File 'lib/sd_events/events.rb', line 2 def category @category end |
#location ⇒ Object
Returns the value of attribute location.
2 3 4 |
# File 'lib/sd_events/events.rb', line 2 def location @location end |
#name ⇒ Object
Returns the value of attribute name.
2 3 4 |
# File 'lib/sd_events/events.rb', line 2 def name @name end |
#time ⇒ Object
Returns the value of attribute time.
2 3 4 |
# File 'lib/sd_events/events.rb', line 2 def time @time end |
#venue ⇒ Object
Returns the value of attribute venue.
2 3 4 |
# File 'lib/sd_events/events.rb', line 2 def venue @venue end |
Class Method Details
.all ⇒ Object
9 10 11 |
# File 'lib/sd_events/events.rb', line 9 def self.all @@all end |
.clear ⇒ Object
13 14 15 |
# File 'lib/sd_events/events.rb', line 13 def self.clear @@all.clear end |
.create_daypart(event_time) ⇒ Object
> “afternoon”
27 28 29 30 |
# File 'lib/sd_events/events.rb', line 27 def self.create_daypart(event_time) #=> "afternoon" SdEvents::Scraper.scrape_daypart(event_time) #=> "SdEvents::Scraper.scrape_daypart("afternoon")" self.empty? end |
.empty? ⇒ Boolean
21 22 23 24 25 |
# File 'lib/sd_events/events.rb', line 21 def self.empty? if @@all.empty? SdEvents::CLI.no_events end end |
.find(id) ⇒ Object
17 18 19 |
# File 'lib/sd_events/events.rb', line 17 def self.find(id) self.all[id.to_i-1] end |