Class: ParamsTransformer::ValueParser::Boolean

Inherits:
ParamsTransformer::ValueParser show all
Defined in:
lib/params_transformer/value_parser/boolean.rb

Instance Attribute Summary

Attributes inherited from ParamsTransformer::ValueParser

#input_value

Instance Method Summary collapse

Methods inherited from ParamsTransformer::ValueParser

#after_init, #initialize

Constructor Details

This class inherits a constructor from ParamsTransformer::ValueParser

Instance Method Details

#parseObject



4
5
6
7
8
9
10
11
# File 'lib/params_transformer/value_parser/boolean.rb', line 4

def parse
  return nil if input_value.nil?
  return nil if input_value == "on"
  return true if input_value == "1"
  return true if input_value == true
  return true if input_value == "true"
  return false
end