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.



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

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.



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

def datetime
  @datetime
end

#formattedObject

Returns the value of attribute formatted.



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

def formatted
  @formatted
end

#levelObject

Returns the value of attribute level.



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

def level
  @level
end

#messageObject

Returns the value of attribute message.



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

def message
  @message
end

Instance Method Details

#<=>(other) ⇒ Object



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

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

#after?(value) ⇒ Boolean

Returns:

  • (Boolean)


30
31
32
33
# File 'lib/eco/api/common/session/logger/log.rb', line 30

def after?(value)
  return true if !value
  datetime >= to_datetime(value)
end

#before?(value) ⇒ Boolean

Returns:

  • (Boolean)


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

def before?(value)
  return true if !value
  datetime <= to_datetime(value)
end

#to_sObject



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

def to_s
  self.formatted
end