Module: TestFactory

Defined in:
lib/test-factory/test_factory.rb

Class Method Summary collapse

Class Method Details

.binary_transform(var) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/test-factory/test_factory.rb', line 3

def self.binary_transform(var)
  case(var)
    when nil
      nil
    when /yes/i, /on/i, :set, true
      :set
    when /no/i, /off/i, :clear, false
      :clear
    else
      raise "The value of your DataObject's checkbox/radio ('#{var}') instance variable is not supported.\nPlease make sure the value conforms to one of the following patterns:\n\n - :set or :clear (Symbol)\n - 'yes', 'no', 'on', or 'off' (String; case insensitive)\n - true or false (Boolean)"
  end
end