Class: OgoneRails::Form

Inherits:
Object
  • Object
show all
Defined in:
lib/ogone-rails/form.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeForm

Returns a new instance of Form.



6
7
8
# File 'lib/ogone-rails/form.rb', line 6

def initialize
  @form_fields = {}
end

Instance Attribute Details

#form_fieldsObject (readonly)

Returns the value of attribute form_fields.



4
5
6
# File 'lib/ogone-rails/form.rb', line 4

def form_fields
  @form_fields
end

#form_tagObject (readonly)

Returns the value of attribute form_tag.



4
5
6
# File 'lib/ogone-rails/form.rb', line 4

def form_tag
  @form_tag
end

Instance Method Details

#add_input(name, value) ⇒ Object



20
21
22
# File 'lib/ogone-rails/form.rb', line 20

def add_input name, value
  @form_fields[name] = value
end

#get_form_tag(action = "", options = {}) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/ogone-rails/form.rb', line 10

def get_form_tag action = "", options = {}      
  # parse form atributes
  form_attributes = ""
  options.each do |key, value|
    form_attributes << "#{key}=\"#{value}\" "
  end
  
  @form_tag = "<form method='post' action='#{action}' #{ form_attributes }>\n"
end