Class: FinchAPI::BooleanModel Abstract Private

Inherits:
Object
  • Object
show all
Extended by:
Converter
Defined in:
lib/finch-api/base_model.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

This class is abstract.

Ruby has no Boolean class; this is something for models to refer to.

Class Method Summary collapse

Methods included from Converter

coerce, dump, dump, type_info

Class Method Details

.==(other) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

  • other (Object)

Returns:

  • (Boolean)


273
# File 'lib/finch-api/base_model.rb', line 273

def self.==(other) = other.is_a?(Class) && other <= FinchAPI::BooleanModel

.===(other) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

  • other (Object)

Returns:

  • (Boolean)


268
# File 'lib/finch-api/base_model.rb', line 268

def self.===(other) = other == true || other == false

.coerce(value, state:) ⇒ Boolean, Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

  • value (Boolean, Object)
  • state (Hash{Symbol=>Object})

    .

    @option state [Boolean, :strong] :strictness

    @option state [HashSymbol=>Object] :exactness

    @option state [Integer] :branched

Returns:

  • (Boolean, Object)


289
290
291
292
# File 'lib/finch-api/base_model.rb', line 289

def coerce(value, state:)
  state.fetch(:exactness)[value == true || value == false ? :yes : :no] += 1
  value
end