Class: Stratagem::Crawler::Input

Inherits:
Object
  • Object
show all
Defined in:
lib/stratagem/crawler/form.rb

Direct Known Subclasses

Button, Select, Toggle

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#idObject

Returns the value of attribute id.



48
49
50
# File 'lib/stratagem/crawler/form.rb', line 48

def id
  @id
end

#nameObject

Returns the value of attribute name.



48
49
50
# File 'lib/stratagem/crawler/form.rb', line 48

def name
  @name
end

#typeObject

Returns the value of attribute type.



49
50
51
# File 'lib/stratagem/crawler/form.rb', line 49

def type
  @type
end

#valueObject

Returns the value of attribute value.



49
50
51
# File 'lib/stratagem/crawler/form.rb', line 49

def value
  @value
end

Instance Method Details

#guess_alternate_attributeObject



71
72
73
74
75
76
77
# File 'lib/stratagem/crawler/form.rb', line 71

def guess_alternate_attribute
  if (name =~ /(.*)\[(.*)\]/)
    $2.to_sym
  else
    name.to_sym
  end
end

#guess_attributeObject



63
64
65
66
67
68
69
# File 'lib/stratagem/crawler/form.rb', line 63

def guess_attribute
  if (name =~ /.*\[(.*)\]/)
    $1.to_sym
  else
    name.to_sym
  end
end

#guess_modelObject



79
80
81
82
# File 'lib/stratagem/crawler/form.rb', line 79

def guess_model
  return $1.camelize if (name =~ /(.*)?\[/)
  return nil
end

#hidden?Boolean

Returns:

  • (Boolean)


84
85
86
# File 'lib/stratagem/crawler/form.rb', line 84

def hidden?
  self.type == 'hidden'
end