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