diff options
author | Abinoam P. Marques Jr. <abinoam@gmail.com> | 2015-07-06 19:14:22 -0300 |
---|---|---|
committer | Abinoam P. Marques Jr. <abinoam@gmail.com> | 2015-07-06 19:14:22 -0300 |
commit | bb9902245d4a719c191e4e01d7e9a5a9e53d38ee (patch) | |
tree | a6c353544c203e4e1ccf4b33436c6fae8d3d6fcc /lib/highline/menu.rb | |
parent | 22e4fdfaee6d4d2ccbfa318fc4083cde05280843 (diff) | |
parent | 88978cd2ff5da525f4feb81abcf32767e40790fa (diff) | |
download | highline-v2.0.0-develop.tar.gz |
Merge pull request #140 from abinoam/feat_refac_askv2.0.0-develop
Develop Release 2.0.0-develop.1
Diffstat (limited to 'lib/highline/menu.rb')
-rw-r--r-- | lib/highline/menu.rb | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/lib/highline/menu.rb b/lib/highline/menu.rb index 44c41b7..71c4f47 100644 --- a/lib/highline/menu.rb +++ b/lib/highline/menu.rb @@ -1,3 +1,5 @@ +# coding: utf-8 + # menu.rb # # Created by Gregory Thomas Brown on 2005-05-10. @@ -235,11 +237,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 @@ -348,19 +349,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 |