Class: Wiki::Api::PageListItem

Inherits:
Object
  • Object
show all
Defined in:
lib/wiki/api/page_list_item.rb

Overview

List Items on a Page (li=xxx)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ PageListItem

Returns a new instance of PageListItem.



9
10
11
12
# File 'lib/wiki/api/page_list_item.rb', line 9

def initialize(options = {})
  self.parent = options[:parent] if options.include?(:parent)
  self.element = options[:element] if options.include?(:element)
end

Instance Attribute Details

#elementObject

Returns the value of attribute element.



7
8
9
# File 'lib/wiki/api/page_list_item.rb', line 7

def element
  @element
end

#parentObject

Returns the value of attribute parent.



7
8
9
# File 'lib/wiki/api/page_list_item.rb', line 7

def parent
  @parent
end

Instance Method Details



18
19
20
21
22
# File 'lib/wiki/api/page_list_item.rb', line 18

def links
  search('a').map do |a|
    PageLink.new(parent: self, element: a)
  end
end

#to_textObject



14
15
16
# File 'lib/wiki/api/page_list_item.rb', line 14

def to_text
  Wiki::Api::Util.element_to_text(element)
end