Sha256: a0a92afa66301bfe39594eaf44289c695523226a2720be1a69b759de3efbc425
Contents?: true
Size: 609 Bytes
Versions: 2
Compression:
Stored size: 609 Bytes
Contents
# encoding: utf-8 module Mixture module Coerce # Handles coercion of the DateTime class. class DateTime < Base type Type::DateTime coerce_to(Type::Object, Itself) coerce_to(Type::String, :to_s) coerce_to(Type::Time, :to_time) coerce_to(Type::Date, :to_date) coerce_to(Type::DateTime, :to_datetime) coerce_to(Type::Array) { |value| value.to_time.to_a } coerce_to(Type::Float) { |value| value.to_time.to_f } coerce_to(Type::Integer) { |value| value.to_time.to_i } coerce_to(Type::Rational) { |value| value.to_time.to_r } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mixture-0.2.0 | lib/mixture/coerce/datetime.rb |
mixture-0.1.0 | lib/mixture/coerce/datetime.rb |