summaryrefslogtreecommitdiff
path: root/lib/highline/menu.rb
diff options
context:
space:
mode:
authorAbinoam Praxedes Marques Jr <abinoam@gmail.com>2015-03-30 00:28:58 -0300
committerAbinoam Praxedes Marques Jr <abinoam@gmail.com>2015-04-29 23:43:29 -0300
commita0743a7fa47edb64a66708ed3085421178f78cc1 (patch)
tree44a48efa753a69270e6fc0438a4549c6ffb17e76 /lib/highline/menu.rb
parent0a443c6e9120b629368d51018173e1daf8b9dc6a (diff)
downloadhighline-a0743a7fa47edb64a66708ed3085421178f78cc1.tar.gz
Add HighLine::TemplateRenderer to aggregate tpl rendering logic
Diffstat (limited to 'lib/highline/menu.rb')
-rw-r--r--lib/highline/menu.rb27
1 files changed, 13 insertions, 14 deletions
diff --git a/lib/highline/menu.rb b/lib/highline/menu.rb
index 03c5bf0..7856676 100644
--- a/lib/highline/menu.rb
+++ b/lib/highline/menu.rb
@@ -238,11 +238,10 @@ class HighLine
# <tt>:menu_only</tt>:: Just the menu items, followed up by a likely
# short _prompt_.
# <i>any ERb String</i>:: Will be taken as the literal _layout_. This
- # String can access <tt>@header</tt>,
- # <tt>@menu</tt> and <tt>@prompt</tt>, but is
- # otherwise evaluated in the typical HighLine
- # context, to provide access to utilities like
- # HighLine.list() primarily.
+ # String can access <tt>header</tt>,
+ # <tt>menu</tt> and <tt>prompt</tt>, but is
+ # otherwise evaluated in the TemplateRenderer
+ # context so each method is properly delegated.
#
# If set to either <tt>:one_line</tt>, or <tt>:menu_only</tt>, _index_
# will default to <tt>:none</tt> and _flow_ will default to
@@ -351,19 +350,19 @@ class HighLine
def to_s( )
case @layout
when :list
- '<%= if @header.nil? then '' else "#{@header}:\n" end %>' +
- "<%= list( @menu, #{@flow.inspect},
+ '<%= if header.nil? then '' else "#{header}:\n" end %>' +
+ "<%= list( menu, #{@flow.inspect},
#{@list_option.inspect} ) %>" +
- "<%= @prompt %>"
+ "<%= prompt %>"
when :one_line
- '<%= if @header.nil? then '' else "#{@header}: " end %>' +
- "<%= @prompt %>" +
- "(<%= list( @menu, #{@flow.inspect},
+ '<%= if header.nil? then '' else "#{header}: " end %>' +
+ "<%= prompt %>" +
+ "(<%= list( menu, #{@flow.inspect},
#{@list_option.inspect} ) %>)" +
- "<%= @prompt[/\s*$/] %>"
+ "<%= prompt[/\s*$/] %>"
when :menu_only
- "<%= list( @menu, #{@flow.inspect},
- #{@list_option.inspect} ) %><%= @prompt %>"
+ "<%= list( menu, #{@flow.inspect},
+ #{@list_option.inspect} ) %><%= prompt %>"
else
@layout
end