Class: ParsleySimpleForm::Constraints::Basics::RangecheckConstraint

Inherits:
ParsleySimpleForm::Constraints::BaseConstraint show all
Includes:
ParsleySimpleForm::Concerns::RangeConcern
Defined in:
lib/parsley_simple_form/constraints/basics/rangecheck_constraint.rb

Instance Method Summary collapse

Methods inherited from ParsleySimpleForm::Constraints::BaseConstraint

#initialize, #input_id, #input_type

Constructor Details

This class inherits a constructor from ParsleySimpleForm::Constraints::BaseConstraint

Instance Method Details

#html_attributesObject



12
13
14
15
16
17
18
19
20
# File 'lib/parsley_simple_form/constraints/basics/rangecheck_constraint.rb', line 12

def html_attributes
  range = parse_range(@options[:rangecheck])
  attributes = {
    :'data-parsley-rangecheck' => range[:string],
    :'data-parsley-rangecheck-message' => I18n::translate('form_validation.message.ragecheck', min: range[:min], max: range[:max])
  }
  attributes.merge!({:'data-parsley-group' => @options[:check_group]}) unless @options[:check_group].nil?
  attributes
end

#match?Boolean

Returns:

  • (Boolean)


7
8
9
10
# File 'lib/parsley_simple_form/constraints/basics/rangecheck_constraint.rb', line 7

def match?
  return false if @options.nil?
  !@options[:rangecheck].nil?
end