Sha256: 84604b624233ff593eea14ad40e570d02ed1c56f9be922dc1ff107ad8ced54e0

Contents?: true

Size: 771 Bytes

Versions: 14

Compression:

Stored size: 771 Bytes

Contents

# encoding: utf-8

module Axiom
  module Types

    # Represents a boolean type
    class Boolean < Object
      coercion_method :to_boolean

      includes true, false

      # Infer the type if the primitive class matches
      #
      # @param [Object] object
      #
      # @return [Class<Axiom::Types::Boolean>]
      #   returned if the primitive class matches
      # @return [nil]
      #   returned if the primitive class does not match
      #
      # @api private
      def self.infer_from_primitive_class(object)
        case object
        when TrueClass.singleton_class, FalseClass.singleton_class
          self
        end
      end

      private_class_method :infer_from_primitive_class

    end # class Boolean
  end # module Types
end # module Axiom

Version data entries

14 entries across 12 versions & 4 rubygems

Version Path
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/axiom-types-0.1.1/lib/axiom/types/boolean.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/axiom-types-0.1.1/lib/axiom/types/boolean.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/axiom-types-0.1.1/lib/axiom/types/boolean.rb
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/axiom-types-0.1.1/lib/axiom/types/boolean.rb
grape-extra_validators-1.0.0 vendor/bundle/ruby/2.4.0/gems/axiom-types-0.1.1/lib/axiom/types/boolean.rb
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/axiom-types-0.1.1/lib/axiom/types/boolean.rb
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/axiom-types-0.1.1/lib/axiom/types/boolean.rb
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/axiom-types-0.1.1/lib/axiom/types/boolean.rb
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/axiom-types-0.1.1/lib/axiom/types/boolean.rb
axiom-types-0.1.1 lib/axiom/types/boolean.rb
axiom-types-0.1.0 lib/axiom/types/boolean.rb
axiom-types-0.0.5 lib/axiom/types/boolean.rb
axiom-types-0.0.4 lib/axiom/types/boolean.rb
axiom-types-0.0.3 lib/axiom/types/boolean.rb