Method: Runo::Checkbox#initialize
- Defined in:
- lib/scalar/checkbox.rb
#initialize(meta = {}) ⇒ Checkbox
Returns a new instance of Checkbox.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/scalar/checkbox.rb', line 8 def initialize( = {}) if [:tokens] [:options] ||= [:tokens] - ['mandatory'] [:options] = ['_on'] if [:options].empty? [:mandatory] = [:tokens].include?('mandatory') && Array([:options]).size > 1 end if [:options].size == 1 && [:default] =~ /^(on|true|yes)$/i [:default] = [:options].first end super end |