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
Instance Method Summary collapse
-
#call(value, options = {}) ⇒ Object
Convert integer to boolean.
Methods inherited from Converter
create, #fail_conversion_type, #initialize
Constructor Details
This class inherits a constructor from Necromancer::Converter
Instance Method Details
#call(value, options = {}) ⇒ Object
Convert integer to boolean
53 54 55 56 57 58 59 60 |
# File 'lib/necromancer/converters/boolean.rb', line 53 def call(value, = {}) strict = .fetch(:strict, config.strict) begin !value.zero? rescue strict ? fail_conversion_type(value) : value end end |