Class: Parser::Event

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

Constant Summary collapse

DATETIME =
'%s %s +0400'
PARSE_FORMAT =
'%d/%m/%y %T %Z'

Instance Method Summary collapse

Constructor Details

#initialize(date, time, description) ⇒ Event

Returns a new instance of Event.



8
9
10
# File 'lib/parser/event.rb', line 8

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

Instance Method Details

#datetimeObject



12
13
14
# File 'lib/parser/event.rb', line 12

def datetime
  @datetime ||= DateTime.strptime(DATETIME % [@date, @time], PARSE_FORMAT)
end

#descriptionObject



16
17
18
# File 'lib/parser/event.rb', line 16

def description
  @description
end

#event_typeObject



24
25
26
# File 'lib/parser/event.rb', line 24

def event_type
  parsed_description.event_type
end

#unusual?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/parser/event.rb', line 28

def unusual?
  Checker.unusual?(datetime)
end

#user_nameObject



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

def user_name
  parsed_description.user_name
end