Sha256: 1719a740d2d3e30908258e14d9169d9f05bf1b6cb51ee1aed8124601f4e63411
Contents?: true
Size: 542 Bytes
Versions: 2
Compression:
Stored size: 542 Bytes
Contents
# encoding: utf-8 module Mixture module Coerce # Handles coercion of the Float class. class Float < Base type Type::Float coerce_to(Type::Object, Itself) coerce_to(Type::String, :to_s) coerce_to(Type::Float, Itself) coerce_to(Type::Integer, :to_i) coerce_to(Type::Rational, :to_r) 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 } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mixture-0.2.0 | lib/mixture/coerce/float.rb |
mixture-0.1.0 | lib/mixture/coerce/float.rb |