Sha256: d5965dae205dd48c41c822784996d54b908d81455d9310befd2f581c8c0e0fff

Contents?: true

Size: 452 Bytes

Versions: 27

Compression:

Stored size: 452 Bytes

Contents

module Foobara
  module BuiltinTypes
    module Datetime
      module Casters
        class SecondsSinceEpoch < Value::Caster
          def applicable?(value)
            value.is_a?(::Integer)
          end

          def applies_message
            "be a an integer representing seconds since epoch"
          end

          def cast(seconds_since_epoch)
            Time.at(seconds_since_epoch)
          end
        end
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
foobara-0.0.7 projects/builtin_types/src/datetime/casters/seconds_since_epoch.rb
foobara-0.0.6 projects/builtin_types/src/datetime/casters/seconds_since_epoch.rb
foobara-0.0.5 projects/builtin_types/src/datetime/casters/seconds_since_epoch.rb
foobara-0.0.4 projects/builtin_types/src/datetime/casters/seconds_since_epoch.rb
foobara-0.0.3 projects/builtin_types/src/datetime/casters/seconds_since_epoch.rb
foobara-0.0.2 projects/builtin_types/src/datetime/casters/seconds_since_epoch.rb
foobara-0.0.1 projects/builtin_types/src/datetime/casters/seconds_since_epoch.rb