Class: Karasuba::LinkAppender
- Inherits:
-
Object
- Object
- Karasuba::LinkAppender
- Defined in:
- lib/karasuba/link_appender.rb
Instance Attribute Summary collapse
-
#append_point ⇒ Object
readonly
Returns the value of attribute append_point.
Instance Method Summary collapse
- #append_link(href, text = '', options = {}) ⇒ Object
- #document ⇒ Object
-
#initialize(append_point) ⇒ LinkAppender
constructor
A new instance of LinkAppender.
Constructor Details
#initialize(append_point) ⇒ LinkAppender
Returns a new instance of LinkAppender.
5 6 7 |
# File 'lib/karasuba/link_appender.rb', line 5 def initialize(append_point) @append_point = append_point end |
Instance Attribute Details
#append_point ⇒ Object (readonly)
Returns the value of attribute append_point.
3 4 5 |
# File 'lib/karasuba/link_appender.rb', line 3 def append_point @append_point end |
Instance Method Details
#append_link(href, text = '', options = {}) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/karasuba/link_appender.rb', line 9 def append_link(href, text = '', = {}) node = Nokogiri::XML::Node.new('a', document) node['href'] = href node['style'] = [:style] if [:style] node['title'] = [:title] if [:title] node.content = text append_point.next = node end |
#document ⇒ Object
18 19 20 |
# File 'lib/karasuba/link_appender.rb', line 18 def document append_point.document end |