Sha256: e5b4e555971861f191154cadd373a5cf7b6ad962e24ef6053df112aeec3b0d41

Contents?: true

Size: 417 Bytes

Versions: 6

Compression:

Stored size: 417 Bytes

Contents

module Predicates

  module Conversions

    def as_string
      simple_predicate(:as_string, -> (v) { v.to_s } )
    end

    def as_int
      simple_predicate(:as_int,  -> (v) { Type.responds(v, :to_i); v.to_i } )
    end

    def as_float
      simple_predicate(:as_float, -> (v) { Type.responds(v, :to_f); v.to_f } )
    end

    def as_array
      simple_predicate(:as_array,  -> (v) { [v] } )
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
totally_lazy-0.0.11 lib/predicates/conversions.rb
totally_lazy-0.0.10 lib/predicates/conversions.rb
totally_lazy-0.0.9 lib/predicates/conversions.rb
totally_lazy-0.0.8 lib/predicates/conversions.rb
totally_lazy-0.0.7 lib/predicates/conversions.rb
totally_lazy-0.0.6 lib/predicates/conversions.rb