Sha256: 14e13da81abfc3af2eee18788093891a760fc52c24a998c2ca74f7d8a4f4f144

Contents?: true

Size: 1.08 KB

Versions: 133

Compression:

Stored size: 1.08 KB

Contents

module Eco
  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
            end

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

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

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

            private

            def to_datetime(value)
              return value if value.is_a?(Time)
              return nil unless value
              Time.parse(value)
            end

          end
        end
      end
    end
  end
end

Version data entries

133 entries across 133 versions & 1 rubygems

Version Path
eco-helpers-2.0.33 lib/eco/api/common/session/logger/log.rb
eco-helpers-2.0.32 lib/eco/api/common/session/logger/log.rb
eco-helpers-2.0.31 lib/eco/api/common/session/logger/log.rb
eco-helpers-2.0.30 lib/eco/api/common/session/logger/log.rb
eco-helpers-2.0.29 lib/eco/api/common/session/logger/log.rb
eco-helpers-2.0.28 lib/eco/api/common/session/logger/log.rb
eco-helpers-2.0.27 lib/eco/api/common/session/logger/log.rb
eco-helpers-2.0.26 lib/eco/api/common/session/logger/log.rb
eco-helpers-2.0.25 lib/eco/api/common/session/logger/log.rb
eco-helpers-2.0.24 lib/eco/api/common/session/logger/log.rb
eco-helpers-2.0.23 lib/eco/api/common/session/logger/log.rb
eco-helpers-2.0.22 lib/eco/api/common/session/logger/log.rb
eco-helpers-2.0.21 lib/eco/api/common/session/logger/log.rb
eco-helpers-2.0.19 lib/eco/api/common/session/logger/log.rb
eco-helpers-2.0.18 lib/eco/api/common/session/logger/log.rb
eco-helpers-2.0.17 lib/eco/api/common/session/logger/log.rb
eco-helpers-2.0.16 lib/eco/api/common/session/logger/log.rb
eco-helpers-2.0.15 lib/eco/api/common/session/logger/log.rb
eco-helpers-2.0.14 lib/eco/api/common/session/logger/log.rb
eco-helpers-2.0.13 lib/eco/api/common/session/logger/log.rb