Sha256: cd4802652370c342b7b7a9e5f2e47eedec85b729c62a5b406f7b802542f8968e

Contents?: true

Size: 461 Bytes

Versions: 2

Compression:

Stored size: 461 Bytes

Contents

# encoding: utf-8

module Mixture
  module Coerce
    # Handles coercion of the Time class.
    class Time < Base
      type Type::Time

      coerce_to(Type::String, :to_s)
      coerce_to(Type::Integer, :to_i)
      coerce_to(Type::Float, :to_f)
      coerce_to(Type::Rational, :to_r)
      coerce_to(Type::Array, :to_a)
      coerce_to(Type::Time, Itself)
      coerce_to(Type::Date, :to_date)
      coerce_to(Type::DateTime, :to_datetime)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mixture-0.2.0 lib/mixture/coerce/time.rb
mixture-0.1.0 lib/mixture/coerce/time.rb