Class: Eco::API::Common::Session::Logger::Log

Inherits:
Object
  • Object
show all
Defined in:
lib/eco/api/common/session/logger/log.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(level, datetime, message, formatted) ⇒ Log

Returns a new instance of Log.



5
6
7
8
9
10
# File 'lib/eco/api/common/session/logger/log.rb', line 5

def initialize(level, datetime, message, formatted)
  @level     = level
  @datetime  = datetime
  @message   = message
  @formatted = formatted
end

Instance Attribute Details

#datetimeObject

Returns the value of attribute datetime.



3
4
5
# File 'lib/eco/api/common/session/logger/log.rb', line 3

def datetime
  @datetime
end

#formattedObject

Returns the value of attribute formatted.



3
4
5
# File 'lib/eco/api/common/session/logger/log.rb', line 3

def formatted
  @formatted
end

#levelObject

Returns the value of attribute level.



3
4
5
# File 'lib/eco/api/common/session/logger/log.rb', line 3

def level
  @level
end

#messageObject

Returns the value of attribute message.



3
4
5
# File 'lib/eco/api/common/session/logger/log.rb', line 3

def message
  @message
end

Instance Method Details

#<=>(other) ⇒ Object



16
17
18
# File 'lib/eco/api/common/session/logger/log.rb', line 16

def <=>(other)
  datetime <=> other.datetime
end

#after?(value) ⇒ Boolean

Returns:

  • (Boolean)


26
27
28
29
30
# File 'lib/eco/api/common/session/logger/log.rb', line 26

def after?(value)
  return true unless value

  datetime >= to_datetime(value)
end

#before?(value) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
23
24
# File 'lib/eco/api/common/session/logger/log.rb', line 20

def before?(value)
  return true unless value

  datetime <= to_datetime(value)
end

#to_sObject



12
13
14
# File 'lib/eco/api/common/session/logger/log.rb', line 12

def to_s
  formatted
end