Module: Phlexi::Form::Options::Length

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

Instance Method Summary collapse

Instance Method Details

#maxlength(maxlength = nil) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/phlexi/form/options/length.rb', line 16

def maxlength(maxlength = nil)
  if maxlength.nil?
    options.fetch(:maxlength) { options[:maxlength] = calculate_maxlength }
  else
    options[:maxlength] = maxlength
    self
  end
end

#minlength(minlength = nil) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/phlexi/form/options/length.rb', line 7

def minlength(minlength = nil)
  if minlength.nil?
    options.fetch(:minlength) { options[:minlength] = calculate_minlength }
  else
    options[:minlength] = minlength
    self
  end
end