class PageBuilder::Elements::Anchor

Creates anchor nodes and adds some helper methods for commonly used attributes

Public Class Methods

new(parent_or_doc) click to toggle source

We have to override new because nokogiri creates the nodes before calling initialize @param parent_or_doc [Nokogiri::XML::Node, Nokogiri::XML::Document] something to pull the current document from

Calls superclass method
# File lib/pagebuilder/elements/anchor.rb, line 13
def self.new(parent_or_doc)
  super('a', parent_or_doc)
end

Public Instance Methods

href() click to toggle source

Gets the current href attribute's value @return [String, nil]

# File lib/pagebuilder/elements/anchor.rb, line 19
def href
  self['href']
end
href=(url) click to toggle source

Sets the href attribute's value @param url [String] the url to link to @return void

# File lib/pagebuilder/elements/anchor.rb, line 26
def href=(url)
  self['href'] = url
end