Module: ListRenderer

Included in:
ListDefault, ListResponseDefault
Defined in:
lib/inquirer/prompts/list.rb

Overview

Base rendering for simple lists

Instance Method Summary collapse

Instance Method Details

#render(heading = nil, list = [], footer = nil) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/inquirer/prompts/list.rb', line 5

def render heading = nil, list = [], footer = nil
  # render the heading
  ( heading.nil? ? "" : @heading % heading ) +
  # render the list
  list.map do |li|
    render_item li
  end.join("") +
  # render the footer
  ( footer.nil? ? "" : @footer % footer )
end

#renderResponse(heading = nil, response = nil) ⇒ Object



16
17
18
19
20
21
# File 'lib/inquirer/prompts/list.rb', line 16

def renderResponse heading = nil, response = nil
  # render the heading
  ( heading.nil? ? "" : @heading % heading ) +
  # render the footer
  ( response.nil? ? "" : @response % response )
end