Class: Horseman::Dom::Form

Inherits:
Element
  • Object
show all
Defined in:
lib/horseman/dom/form.rb

Instance Attribute Summary collapse

Attributes inherited from Element

#id, #name

Instance Method Summary collapse

Methods inherited from Element

#initialize

Constructor Details

This class inherits a constructor from Horseman::Dom::Element

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *arguments, &block) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/horseman/dom/form.rb', line 12

def method_missing(method, *arguments, &block)
  case method
  when :[]
    indexer = arguments[0]
    field = @fields.select {|name, field| name.to_s == indexer}.map {|k,v| v}.first
    return field unless field.nil?  
  end
  
  puts "Not implemented in Form: #{method} #{arguments.join(',')}"
end

Instance Attribute Details

#actionObject

Returns the value of attribute action.



6
7
8
# File 'lib/horseman/dom/form.rb', line 6

def action
  @action
end

#encodingObject

Returns the value of attribute encoding.



6
7
8
# File 'lib/horseman/dom/form.rb', line 6

def encoding
  @encoding
end

#fieldsObject

Returns the value of attribute fields.



6
7
8
# File 'lib/horseman/dom/form.rb', line 6

def fields
  @fields
end

#submitObject

Returns the value of attribute submit.



6
7
8
# File 'lib/horseman/dom/form.rb', line 6

def submit
  @submit
end

Instance Method Details

#respond_to?(method_sym, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/horseman/dom/form.rb', line 8

def respond_to?(method_sym, include_private = false)
  true
end