Class: Attribeauty::Types::Boolean

Inherits:
Object
  • Object
show all
Defined in:
lib/attribeauty/types/boolean.rb

Overview

custom boolean type

Constant Summary collapse

FALSE_VALUES =
[
  false, 0,
  "0", :"0",
  "f", :f,
  "F", :F,
  "false", false,
  "FALSE", :FALSE,
  "off", :off,
  "OFF", :OFF
].to_set.freeze

Instance Method Summary collapse

Instance Method Details

#cast(value) ⇒ Object



18
19
20
21
22
# File 'lib/attribeauty/types/boolean.rb', line 18

def cast(value)
  return false if value.nil?

  !FALSE_VALUES.include?(value)
end