Class: MDOM::Link

Inherits:
InlineNode show all
Defined in:
lib/mdom/nodes.rb

Instance Attribute Summary

Attributes inherited from Node

#attributes, #children, #parent, #type

Instance Method Summary collapse

Methods inherited from Node

#[], #ancestors, #append, #children?, #depth, #each_child, #empty?, #find, #find_all, #insert_after, #insert_before, #inspect, #plain_text, #pretty_print, #remove, #replace, #root, #text?, #to_markdown, #to_s, #walk

Constructor Details

#initialize(dest, title: nil, children: []) ⇒ Link

Returns a new instance of Link.



167
168
169
170
171
# File 'lib/mdom/nodes.rb', line 167

def initialize(dest, title: nil, children: [])
  attrs = { destination: dest }
  attrs[:title] = title unless title.nil?
  super(Types::LINK, attributes: attrs, children: children)
end

Instance Method Details

#destinationObject



173
174
175
# File 'lib/mdom/nodes.rb', line 173

def destination
  attributes[:destination]
end

#titleObject



177
178
179
# File 'lib/mdom/nodes.rb', line 177

def title
  attributes[:title]
end