Class: Cardboard::Field::Boolean

Inherits:
Cardboard::Field show all
Defined in:
app/models/cardboard/field/boolean.rb

Instance Attribute Summary

Attributes inherited from Cardboard::Field

#seeding

Instance Method Summary collapse

Methods inherited from Cardboard::Field

new_with_castnew, #required?, #type, #type=

Instance Method Details

#defaultObject



13
14
15
# File 'app/models/cardboard/field/boolean.rb', line 13

def default
  [true, false].sample
end

#valueObject



5
6
7
# File 'app/models/cardboard/field/boolean.rb', line 5

def value
  to_boolean(value_uid) 
end

#value=(val) ⇒ Object



9
10
11
# File 'app/models/cardboard/field/boolean.rb', line 9

def value=(val)
  self.value_uid = to_boolean(val) #saved as a consistent string 't'
end