Sha256: e77ac948364302f02698422405ed2b0817158bf02557925e879fccdee44cfc47

Contents?: true

Size: 417 Bytes

Versions: 8

Compression:

Stored size: 417 Bytes

Contents

module Predicates

  module Conversions

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

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

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

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

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
totally_lazy-0.0.20 lib/predicates/conversions.rb
totally_lazy-0.0.19 lib/predicates/conversions.rb
totally_lazy-0.0.18 lib/predicates/conversions.rb
totally_lazy-0.0.16 lib/predicates/conversions.rb
totally_lazy-0.0.15 lib/predicates/conversions.rb
totally_lazy-0.0.14 lib/predicates/conversions.rb
totally_lazy-0.0.13 lib/predicates/conversions.rb
totally_lazy-0.0.12 lib/predicates/conversions.rb