Class: Swordfish::Node::Hyperlink

Inherits:
Inline show all
Defined in:
lib/swordfish/nodes/hyperlink.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#children, #content, #style

Instance Method Summary collapse

Methods inherited from Base

#append, #clear_children, #find_nodes_by_type, #inform!, #initialize, #replace, #replace_with, #stylize, #wrap_children

Constructor Details

This class inherits a constructor from Swordfish::Node::Base

Instance Attribute Details

#hrefObject

Returns the value of attribute href.



7
8
9
# File 'lib/swordfish/nodes/hyperlink.rb', line 7

def href
  @href
end

Instance Method Details

#to_htmlObject



9
10
11
12
# File 'lib/swordfish/nodes/hyperlink.rb', line 9

def to_html
  @href ||= ""
  "<a href=\"#{URI::escape(@href)}\">#{@children.map(&:to_html).join}</a>"
end