class Necromancer::BooleanConverters::IntegerToBooleanConverter

An object that converts an Integer to a Boolean

Public Instance Methods

call(value, strict: config.strict) click to toggle source

Convert integer to boolean

@example

converter.call(1)  # => true

@example

converter.call(0)  # => false

@api public

# File lib/necromancer/converters/boolean.rb, line 52
def call(value, strict: config.strict)
  !value.zero?
rescue StandardError
  strict ? raise_conversion_type(value) : value
end