Sha256: 4ac805f05c8cd2c006a9d48839baccf00cf82f2e4fca300cd5285e8019ec492e

Contents?: true

Size: 539 Bytes

Versions: 2

Compression:

Stored size: 539 Bytes

Contents

# encoding: utf-8
# frozen_string_literal: true

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

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mixture-0.7.1 lib/mixture/coerce/time.rb
mixture-0.7.0 lib/mixture/coerce/time.rb