lib/eco/api/common/session/logger/log.rb in eco-helpers-3.0.4 vs lib/eco/api/common/session/logger/log.rb in eco-helpers-3.0.5
- old
+ new
@@ -2,45 +2,46 @@
module API
module Common
module Session
class Logger
class Log
-
attr_accessor :level, :datetime, :message, :formatted
def initialize(level, datetime, message, formatted)
@level = level
@datetime = datetime
@message = message
@formatted = formatted
end
def to_s
- self.formatted
+ formatted
end
def <=>(other)
- self.datetime <=> other.datetime
+ datetime <=> other.datetime
end
def before?(value)
- return true if !value
+ return true unless value
+
datetime <= to_datetime(value)
end
def after?(value)
- return true if !value
+ return true unless value
+
datetime >= to_datetime(value)
end
private
def to_datetime(value)
return value if value.is_a?(Time)
- return nil unless value
+ return unless value
+
Time.parse(value)
end
-
end
end
end
end
end