Module: Sinatra::FormKeeper::Helpers

Defined in:
lib/sinatra/formkeeper.rb

Instance Method Summary collapse

Instance Method Details

#fill_in_form(output, others = {}) ⇒ Object



111
112
113
114
115
# File 'lib/sinatra/formkeeper.rb', line 111

def fill_in_form(output, others={})
  filled = settings.form_respondent.fill_up(output, params.merge(others))
  output.replace(filled)
  output
end

#form(&block) ⇒ Object



101
102
103
104
105
106
107
108
109
110
# File 'lib/sinatra/formkeeper.rb', line 101

def form(&block)
  if block
    rule = ::FormKeeper::Rule.new
    rule.instance_eval(&block)
    messages = settings.form_failure_messages
    @form_report = 
      settings.form_validator.validate(params, rule, messages)
  end
  @form_report
end

#reset_formObject



98
99
100
# File 'lib/sinatra/formkeeper.rb', line 98

def reset_form
  @form_report = ::FormKeeper::Report.new
end