Sha256: 39709e52666d41f0723b78179d150e1e523d0e1ab9267a8bb7b7d9bc563d0711

Contents?: true

Size: 710 Bytes

Versions: 38

Compression:

Stored size: 710 Bytes

Contents

module Foobara
  module BuiltinTypes
    module Duck
      module SupportedCasters
        class AllowNil < TypeDeclarations::Caster
          class << self
            def requires_declaration_data?
              true
            end

            def default_declaration_data
              false
            end
          end
          def applicable?(value)
            value.nil? && allow_nil?
          end

          def allow_nil?
            declaration_data
          end

          def cast(value)
            value
          end

          def applies_message
            "be nil"
          end

          def priority
            Priority::HIGH
          end
        end
      end
    end
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
foobara-0.0.38 projects/builtin_types/src/duck/supported_casters/allow_nil.rb
foobara-0.0.37 projects/builtin_types/src/duck/supported_casters/allow_nil.rb
foobara-0.0.36 projects/builtin_types/src/duck/supported_casters/allow_nil.rb
foobara-0.0.35 projects/builtin_types/src/duck/supported_casters/allow_nil.rb
foobara-0.0.34 projects/builtin_types/src/duck/supported_casters/allow_nil.rb
foobara-0.0.33 projects/builtin_types/src/duck/supported_casters/allow_nil.rb
foobara-0.0.32 projects/builtin_types/src/duck/supported_casters/allow_nil.rb
foobara-0.0.31 projects/builtin_types/src/duck/supported_casters/allow_nil.rb
foobara-0.0.30 projects/builtin_types/src/duck/supported_casters/allow_nil.rb
foobara-0.0.29 projects/builtin_types/src/duck/supported_casters/allow_nil.rb
foobara-0.0.28 projects/builtin_types/src/duck/supported_casters/allow_nil.rb
foobara-0.0.27 projects/builtin_types/src/duck/supported_casters/allow_nil.rb
foobara-0.0.26 projects/builtin_types/src/duck/supported_casters/allow_nil.rb
foobara-0.0.25 projects/builtin_types/src/duck/supported_casters/allow_nil.rb
foobara-0.0.24 projects/builtin_types/src/duck/supported_casters/allow_nil.rb
foobara-0.0.23 projects/builtin_types/src/duck/supported_casters/allow_nil.rb
foobara-0.0.22 projects/builtin_types/src/duck/supported_casters/allow_nil.rb
foobara-0.0.21 projects/builtin_types/src/duck/supported_casters/allow_nil.rb
foobara-0.0.20 projects/builtin_types/src/duck/supported_casters/allow_nil.rb
foobara-0.0.19 projects/builtin_types/src/duck/supported_casters/allow_nil.rb