Class: SwedbankPay::SidebarHTMLBuilder

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

Overview

The builder of HTML for the Sidebar

Instance Method Summary collapse

Constructor Details

#initialize(tree) ⇒ SidebarHTMLBuilder

Returns a new instance of SidebarHTMLBuilder.



9
10
11
# File 'lib/sidebar_html_builder.rb', line 9

def initialize(tree)
  @tree = tree
end

Instance Method Details

#build(current_page) ⇒ Object

Raises:

  • (ArgumentError)


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

def build(current_page)
  raise ArgumentError, 'current_page cannot be nil' if current_page.nil?
  raise ArgumentError, "#{current_page.class} is not a #{SidebarPage}" unless current_page.is_a? SidebarPage

  build_markup(@tree, current_page)
end