Module: Phlexi::Form::Options::Required

Included in:
Builder
Defined in:
lib/phlexi/form/options/required.rb

Instance Method Summary collapse

Instance Method Details

#required!(required = true) ⇒ Object



11
12
13
14
# File 'lib/phlexi/form/options/required.rb', line 11

def required!(required = true)
  options[:required] = required
  self
end

#required?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/phlexi/form/options/required.rb', line 7

def required?
  options.fetch(:required) { options[:required] = calculate_required }
end