Sha256: d11066a34f34cb9f93236e5ae1248680ea06dfd57b93f6150c2337fbf6d325ac

Contents?: true

Size: 372 Bytes

Versions: 26

Compression:

Stored size: 372 Bytes

Contents

module Foobara
  module BuiltinTypes
    module Boolean
      module Casters
        class Numeric < Value::Caster
          def applicable?(value)
            [0, 1].include?(value)
          end

          def applies_message
            "be 0 or 1"
          end

          def cast(value)
            !value.zero?
          end
        end
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
foobara-0.0.26 projects/builtin_types/src/boolean/casters/numeric.rb
foobara-0.0.25 projects/builtin_types/src/boolean/casters/numeric.rb
foobara-0.0.24 projects/builtin_types/src/boolean/casters/numeric.rb
foobara-0.0.23 projects/builtin_types/src/boolean/casters/numeric.rb
foobara-0.0.22 projects/builtin_types/src/boolean/casters/numeric.rb
foobara-0.0.21 projects/builtin_types/src/boolean/casters/numeric.rb
foobara-0.0.20 projects/builtin_types/src/boolean/casters/numeric.rb
foobara-0.0.19 projects/builtin_types/src/boolean/casters/numeric.rb
foobara-0.0.18 projects/builtin_types/src/boolean/casters/numeric.rb
foobara-0.0.17 projects/builtin_types/src/boolean/casters/numeric.rb
foobara-0.0.16 projects/builtin_types/src/boolean/casters/numeric.rb
foobara-0.0.15 projects/builtin_types/src/boolean/casters/numeric.rb
foobara-0.0.14 projects/builtin_types/src/boolean/casters/numeric.rb
foobara-0.0.13 projects/builtin_types/src/boolean/casters/numeric.rb
foobara-0.0.12 projects/builtin_types/src/boolean/casters/numeric.rb
foobara-0.0.11 projects/builtin_types/src/boolean/casters/numeric.rb
foobara-0.0.10 projects/builtin_types/src/boolean/casters/numeric.rb
foobara-0.0.9 projects/builtin_types/src/boolean/casters/numeric.rb
foobara-0.0.8 projects/builtin_types/src/boolean/casters/numeric.rb
foobara-0.0.7 projects/builtin_types/src/boolean/casters/numeric.rb