Class: SwedbankPay::SidebarParser

Inherits:
Object
  • Object
show all
Defined in:
lib/sidebar_parser.rb

Overview

The Sidebar renderer

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(site) ⇒ SidebarParser

Returns a new instance of SidebarParser.

Raises:

  • (ArgumentError)


13
14
15
16
17
18
# File 'lib/sidebar_parser.rb', line 13

def initialize(site)
  raise ArgumentError, 'Site cannot be nil' if site.nil?
  raise ArgumentError, 'Site must be a Jekyll::Site' unless site.is_a? Jekyll::Site

  @pages = convert(site.pages)
end

Instance Attribute Details

#pagesObject (readonly)

Returns the value of attribute pages.



11
12
13
# File 'lib/sidebar_parser.rb', line 11

def pages
  @pages
end

Instance Method Details

#parse(tree) ⇒ Object

Raises:

  • (ArgumentError)


20
21
22
23
24
25
# File 'lib/sidebar_parser.rb', line 20

def parse(tree)
  raise ArgumentError, 'tree cannot be nil' if tree.nil?
  raise ArgumentError, 'tree must be a SidebarTreeBuilder' unless tree.is_a? SidebarTreeBuilder

  parse_html(tree)
end