Class: Trackerific::Event

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

Overview

Provides details for a tracking event

Instance Method Summary (collapse)

Constructor Details

- (Event) initialize(date, description, location)

Provides a new instance of Event

Parameters:

  • the (Time)

    date / time of the event

  • the (String)

    event’s description

  • where (String)

    the event took place



8
9
10
11
12
# File 'lib/trackerific_event.rb', line 8

def initialize(date, description, location)
  @date = date
  @description = description
  @location = location
end

Instance Method Details

- (Time) date

The date / time of the event

Returns:

  • (Time)

    the date / time of the event



15
16
17
# File 'lib/trackerific_event.rb', line 15

def date
  @date
end

- (String) description

The event’s description.

Returns:

  • (String)

    the event’s description.



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

def description
  @description
end

- (String) location

Where the event took place (usually in City State Zip format)

Returns:

  • (String)

    where the event took place (usually in City State Zip format)



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

def location
  @location
end

- (String) to_s

Converts the event into a string

Returns:

  • (String)

    converts the event into a string



31
32
33
34
35
36
# File 'lib/trackerific_event.rb', line 31

def to_s
  dte = self.date.strftime('%b %d %I:%M %P')
  des = self.description
  loc = self.location
  "#{dte} #{des} #{loc}"
end