formhelper¶ ↑
This is a library to create different form field elements, allows form object to parse into different formats (YAML, JSON, XML)
INSTALLATION¶ ↑
sudo gem install formhelper
BASIC USAGE¶ ↑
require ‘rubygems’
require ‘formhelper’
# Create a form object
form = FormHelper::Form.new()
# Create short answer and long answer objects
sa = FormHelper::ShortAnswer.new(:id => “email_1”,:label => “Personal email address” )
la = FormHelper::LongAnswer.new(:id => “comment_1”,:label => “Provide your comments below”)
# Add short answer and long answer objects
form.add(sa)
form.add(la)
# Returns YAML format of form
form.to_yml
# Returns XML format of form
form.to_yml