Class: WebUnit::Link

Inherits:
HtmlElem show all
Defined in:
lib/webunit/link.rb

Instance Attribute Summary collapse

Attributes inherited from HtmlElem

#array, #attrs, #children, #data, #name, #tag

Instance Method Summary collapse

Methods inherited from HtmlElem

#append, #extract, #find, #has?, #inspect, #print, #readlink, #search

Constructor Details

#initialize(ah) ⇒ Link

Returns a new instance of Link.



15
16
17
18
19
20
# File 'lib/webunit/link.rb', line 15

def initialize( ah )
  super( 'a', ah )
  @href = ah["href"]
  @target = ah["target"]
  @onClick = ah["onclick"]
end

Instance Attribute Details

#hrefObject (readonly)

Returns the value of attribute href.



13
14
15
# File 'lib/webunit/link.rb', line 13

def href
  @href
end

#onClickObject (readonly)

Returns the value of attribute onClick.



13
14
15
# File 'lib/webunit/link.rb', line 13

def onClick
  @onClick
end

#targetObject (readonly)

Returns the value of attribute target.



13
14
15
# File 'lib/webunit/link.rb', line 13

def target
  @target
end

Instance Method Details

#readObject

— Link#read

return a Response of getting of '@href'


27
28
29
# File 'lib/webunit/link.rb', line 27

def read
  Response::new.init_http( @href, "GET" ) if @href != nil
end