Class: Watobo::Parser::HTML::InputField

Inherits:
Object
  • Object
show all
Defined in:
lib/watobo/parser/html.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(input_css) ⇒ InputField

Returns a new instance of InputField.



60
61
62
63
64
65
66
# File 'lib/watobo/parser/html.rb', line 60

def initialize(input_css)  
  @css = input_css        
      @id = input_css["id"].nil? ? "" : input_css["id"] 
      @value = input_css["value"].nil? ? "" : input_css["value"]
      @name = input_css["name"].nil? ? "" : input_css["name"]  
      #@autocomplete = input_css["autocomplete"]        
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



68
69
70
# File 'lib/watobo/parser/html.rb', line 68

def method_missing(name, *args, &block)
  @css[name.to_s].nil? ? "" : input_css[name.to_s]
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



47
48
49
# File 'lib/watobo/parser/html.rb', line 47

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



49
50
51
# File 'lib/watobo/parser/html.rb', line 49

def name
  @name
end

#valueObject (readonly)

Returns the value of attribute value.



48
49
50
# File 'lib/watobo/parser/html.rb', line 48

def value
  @value
end

Instance Method Details

#to_url_parmObject



56
57
58
# File 'lib/watobo/parser/html.rb', line 56

def to_url_parm()
  Watobo::UrlParameter.new(:name => @name, :value => @value)
end

#to_www_form_parmObject

attr :autocomplete



52
53
54
# File 'lib/watobo/parser/html.rb', line 52

def to_www_form_parm()
  Watobo::WWWFormParameter.new(:name => @name, :value => @value)
end