class ParsleySimpleForm::FormBuilder

Attributes

attribute_name[R]

Public Instance Methods

find_input(*args) click to toggle source
Calls superclass method
# File lib/parsley_simple_form/form_builder.rb, line 16
def find_input(*args)
  super(*args)
end
input(attribute_name, options = {}, &block) click to toggle source
Calls superclass method
# File lib/parsley_simple_form/form_builder.rb, line 7
def input(attribute_name, options = {}, &block)
  @attribute_name = attribute_name
  @options = options
  @block = block
  @options[:input_html] ||= {} 
  @options[:input_html].merge! parsley_html
  super(@attribute_name, @options, &@block)
end

Private Instance Methods

basic_constraints() click to toggle source
# File lib/parsley_simple_form/form_builder.rb, line 36
def basic_constraints
  # dinamically load all classes of Constraints::Basics module
  Constraints::Basics.constants
    .select { |c| Constraints::Basics.const_get(c).is_a?(Class) }
    .map { |c| Constraints::Basics.const_get(c) }
end
check_constraint(constraint) click to toggle source
# File lib/parsley_simple_form/form_builder.rb, line 30
def check_constraint(constraint)
  constraint_checker = constraint.new(self,@options,&@block)
  return constraint_checker.html_attributes if constraint_checker.match?
  {}
end
parsley_html() click to toggle source
# File lib/parsley_simple_form/form_builder.rb, line 21
def parsley_html
  message = {}     

  basic_constraints.each do |constraint|
    message.merge! check_constraint(constraint)
  end
  message
end