Class: SdEvents::Events

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

Constant Summary collapse

@@all =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeEvents

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

#categoryObject

Returns the value of attribute category.



2
3
4
# File 'lib/sd_events/events.rb', line 2

def category
  @category
end

#locationObject

Returns the value of attribute location.



2
3
4
# File 'lib/sd_events/events.rb', line 2

def location
  @location
end

#nameObject

Returns the value of attribute name.



2
3
4
# File 'lib/sd_events/events.rb', line 2

def name
  @name
end

#timeObject

Returns the value of attribute time.



2
3
4
# File 'lib/sd_events/events.rb', line 2

def time
  @time
end

#venueObject

Returns the value of attribute venue.



2
3
4
# File 'lib/sd_events/events.rb', line 2

def venue
  @venue
end

Class Method Details

.allObject



9
10
11
# File 'lib/sd_events/events.rb', line 9

def self.all
  @@all
end

.clearObject



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

Returns:

  • (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