Class: UtahCountyAaMeetingFinder::Meetings

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

Constant Summary collapse

@@all =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = nil, date = nil, address = nil, time = nil) ⇒ Meetings

Returns a new instance of Meetings.



12
13
14
15
16
17
18
# File 'lib/utah_county_aa_meeting_finder/meetings.rb', line 12

def initialize(name = nil, date = nil, address = nil, time = nil)
  @name =name
  @date = date
  @address = address
  @time = time
  @@all<<self
end

Instance Attribute Details

#addressObject

Returns the value of attribute address.



2
3
4
# File 'lib/utah_county_aa_meeting_finder/meetings.rb', line 2

def address
  @address
end

#dateObject

Returns the value of attribute date.



2
3
4
# File 'lib/utah_county_aa_meeting_finder/meetings.rb', line 2

def date
  @date
end

#nameObject

Returns the value of attribute name.



2
3
4
# File 'lib/utah_county_aa_meeting_finder/meetings.rb', line 2

def name
  @name
end

#timeObject

Returns the value of attribute time.



2
3
4
# File 'lib/utah_county_aa_meeting_finder/meetings.rb', line 2

def time
  @time
end

Class Method Details

.allObject



26
27
28
# File 'lib/utah_county_aa_meeting_finder/meetings.rb', line 26

def self.all
  @@all
end

.find_by_day(day) ⇒ Object



20
21
22
23
24
# File 'lib/utah_county_aa_meeting_finder/meetings.rb', line 20

def self.find_by_day(day)
  all.select do |meeting|
    meeting.date.downcase == day.downcase
  end
end

.new_meetings(meeting) ⇒ Object



6
7
8
9
10
# File 'lib/utah_county_aa_meeting_finder/meetings.rb', line 6

def self.new_meetings(meeting)
  if meeting.css(".groupmtgsm").text != ""
    new = self.new(meeting.css(".groupmtgsm").text, meeting.css(".day u").text, meeting.css(".marq a").attribute('href').text, meeting.css(".day").text.split("\n")[1])
  end
end