Class: Wiki::Api::PageListItem
- Inherits:
-
Object
- Object
- Wiki::Api::PageListItem
- Defined in:
- lib/wiki/api/page_list_item.rb
Overview
List Items on a Page (li=xxx)
Instance Attribute Summary collapse
-
#element ⇒ Object
Returns the value of attribute element.
-
#parent ⇒ Object
Returns the value of attribute parent.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ PageListItem
constructor
A new instance of PageListItem.
- #links ⇒ Object
- #to_text ⇒ Object
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( = {}) self.parent = [:parent] if .include?(:parent) self.element = [:element] if .include?(:element) end |
Instance Attribute Details
#element ⇒ Object
Returns the value of attribute element.
7 8 9 |
# File 'lib/wiki/api/page_list_item.rb', line 7 def element @element end |
#parent ⇒ Object
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
#links ⇒ Object
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_text ⇒ Object
14 15 16 |
# File 'lib/wiki/api/page_list_item.rb', line 14 def to_text Wiki::Api::Util.element_to_text(element) end |