Class: Necromancer::BooleanConverters::IntegerToBooleanConverter
- Inherits:
-
Converter
- Object
- Converter
- Necromancer::BooleanConverters::IntegerToBooleanConverter
- Defined in:
- lib/necromancer/converters/boolean.rb
Overview
An object that converts an Integer to a Boolean
Instance Attribute Summary
Attributes inherited from Converter
#config, #convert, #source, #target
Instance Method Summary collapse
-
#call(value, strict: config.strict) ⇒ Object
Convert integer to boolean.
Methods inherited from Converter
create, #initialize, #raise_conversion_type
Constructor Details
This class inherits a constructor from Necromancer::Converter
Instance Method Details
#call(value, strict: config.strict) ⇒ Object
Convert integer to boolean
52 53 54 55 56 |
# 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 |