class ParsleySimpleForm::Constraints::Basics::MaxConstraint

Public Instance Methods

html_attributes() click to toggle source
# File lib/parsley_simple_form/constraints/basics/max_constraint.rb, line 14
def html_attributes
  attributes = {:'data-parsley-max-message' => I18n::translate('form_validation.message.max', max: @max)}
  attributes.merge!({:type => 'number', :max => @max}) if (@input_html[:max].nil? || !mapped_type.to_s == 'number')
  attributes
end
match?() click to toggle source
# File lib/parsley_simple_form/constraints/basics/max_constraint.rb, line 7
def match?
  return false if @options.nil?
  @input_html = @options[:input_html]
  @max = @options[:max] || @input_html[:max]
  !@options[:max].nil? || (!@input_html[:max].nil? && mapped_type.to_s == 'number')
end