challah 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. data/CHANGELOG.md +4 -0
  2. data/lib/challah/version.rb +1 -1
  3. data/lib/tasks/crud.rake +23 -53
  4. data/vendor/bundle/cache/highline-1.6.11.gem +0 -0
  5. data/vendor/bundle/gems/highline-1.6.11/AUTHORS +3 -0
  6. data/vendor/bundle/gems/highline-1.6.11/CHANGELOG +304 -0
  7. data/vendor/bundle/gems/highline-1.6.11/COPYING +340 -0
  8. data/vendor/bundle/gems/highline-1.6.11/INSTALL +55 -0
  9. data/vendor/bundle/gems/highline-1.6.11/LICENSE +7 -0
  10. data/vendor/bundle/gems/highline-1.6.11/README +63 -0
  11. data/vendor/bundle/gems/highline-1.6.11/Rakefile +53 -0
  12. data/vendor/bundle/gems/highline-1.6.11/TODO +6 -0
  13. data/vendor/bundle/gems/highline-1.6.11/examples/ansi_colors.rb +38 -0
  14. data/vendor/bundle/gems/highline-1.6.11/examples/asking_for_arrays.rb +18 -0
  15. data/vendor/bundle/gems/highline-1.6.11/examples/basic_usage.rb +75 -0
  16. data/vendor/bundle/gems/highline-1.6.11/examples/color_scheme.rb +32 -0
  17. data/vendor/bundle/gems/highline-1.6.11/examples/limit.rb +12 -0
  18. data/vendor/bundle/gems/highline-1.6.11/examples/menus.rb +65 -0
  19. data/vendor/bundle/gems/highline-1.6.11/examples/overwrite.rb +19 -0
  20. data/vendor/bundle/gems/highline-1.6.11/examples/page_and_wrap.rb +322 -0
  21. data/vendor/bundle/gems/highline-1.6.11/examples/password.rb +7 -0
  22. data/vendor/bundle/gems/highline-1.6.11/examples/trapping_eof.rb +22 -0
  23. data/vendor/bundle/gems/highline-1.6.11/examples/using_readline.rb +17 -0
  24. data/vendor/bundle/gems/highline-1.6.11/highline.gemspec +36 -0
  25. data/vendor/bundle/gems/highline-1.6.11/lib/highline/color_scheme.rb +136 -0
  26. data/vendor/bundle/gems/highline-1.6.11/lib/highline/compatibility.rb +16 -0
  27. data/vendor/bundle/gems/highline-1.6.11/lib/highline/import.rb +43 -0
  28. data/vendor/bundle/gems/highline-1.6.11/lib/highline/menu.rb +398 -0
  29. data/vendor/bundle/gems/highline-1.6.11/lib/highline/question.rb +465 -0
  30. data/vendor/bundle/gems/highline-1.6.11/lib/highline/string_extensions.rb +98 -0
  31. data/vendor/bundle/gems/highline-1.6.11/lib/highline/style.rb +184 -0
  32. data/vendor/bundle/gems/highline-1.6.11/lib/highline/system_extensions.rb +180 -0
  33. data/vendor/bundle/gems/highline-1.6.11/lib/highline.rb +978 -0
  34. data/vendor/bundle/gems/highline-1.6.11/setup.rb +1360 -0
  35. data/vendor/bundle/gems/highline-1.6.11/site/highline.css +65 -0
  36. data/vendor/bundle/gems/highline-1.6.11/site/images/logo.png +0 -0
  37. data/vendor/bundle/gems/highline-1.6.11/site/index.html +58 -0
  38. data/vendor/bundle/gems/highline-1.6.11/test/string_methods.rb +34 -0
  39. data/vendor/bundle/gems/highline-1.6.11/test/tc_color_scheme.rb +98 -0
  40. data/vendor/bundle/gems/highline-1.6.11/test/tc_highline.rb +962 -0
  41. data/vendor/bundle/gems/highline-1.6.11/test/tc_import.rb +54 -0
  42. data/vendor/bundle/gems/highline-1.6.11/test/tc_menu.rb +429 -0
  43. data/vendor/bundle/gems/highline-1.6.11/test/tc_string_extension.rb +22 -0
  44. data/vendor/bundle/gems/highline-1.6.11/test/tc_string_highline.rb +40 -0
  45. data/vendor/bundle/gems/highline-1.6.11/test/tc_style.rb +569 -0
  46. data/vendor/bundle/gems/highline-1.6.11/test/ts_all.rb +18 -0
  47. data/vendor/bundle/specifications/highline-1.6.11.gemspec +29 -0
  48. metadata +63 -8
@@ -0,0 +1,136 @@
1
+ #!/usr/local/bin/ruby -w
2
+
3
+ # color_scheme.rb
4
+ #
5
+ # Created by Jeremy Hinegardner on 2007-01-24
6
+ # Copyright 2007. All rights reserved
7
+ #
8
+ # This is Free Software. See LICENSE and COPYING for details
9
+
10
+ class HighLine
11
+ #
12
+ # ColorScheme objects encapsulate a named set of colors to be used in the
13
+ # HighLine.colors() method call. For example, by applying a ColorScheme that
14
+ # has a <tt>:warning</tt> color then the following could be used:
15
+ #
16
+ # colors("This is a warning", :warning)
17
+ #
18
+ # A ColorScheme contains named sets of HighLine color constants.
19
+ #
20
+ # Example: Instantiating a color scheme, applying it to HighLine,
21
+ # and using it:
22
+ #
23
+ # ft = HighLine::ColorScheme.new do |cs|
24
+ # cs[:headline] = [ :bold, :yellow, :on_black ]
25
+ # cs[:horizontal_line] = [ :bold, :white ]
26
+ # cs[:even_row] = [ :green ]
27
+ # cs[:odd_row] = [ :magenta ]
28
+ # end
29
+ #
30
+ # HighLine.color_scheme = ft
31
+ # say("<%= color('Headline', :headline) %>")
32
+ # say("<%= color('-'*20, :horizontal_line) %>")
33
+ # i = true
34
+ # ("A".."D").each do |row|
35
+ # if i then
36
+ # say("<%= color('#{row}', :even_row ) %>")
37
+ # else
38
+ # say("<%= color('#{row}', :odd_row) %>")
39
+ # end
40
+ # i = !i
41
+ # end
42
+ #
43
+ #
44
+ class ColorScheme
45
+ #
46
+ # Create an instance of HighLine::ColorScheme. The customization can
47
+ # happen as a passed in Hash or via the yielded block. Key's are
48
+ # converted to <tt>:symbols</tt> and values are converted to HighLine
49
+ # constants.
50
+ #
51
+ def initialize( h = nil )
52
+ @scheme = Hash.new
53
+ load_from_hash(h) unless h.nil?
54
+ yield self if block_given?
55
+ end
56
+
57
+ # Load multiple colors from key/value pairs.
58
+ def load_from_hash( h )
59
+ h.each_pair do |color_tag, constants|
60
+ self[color_tag] = constants
61
+ end
62
+ end
63
+
64
+ # Does this color scheme include the given tag name?
65
+ def include?( color_tag )
66
+ @scheme.keys.include?(to_symbol(color_tag))
67
+ end
68
+
69
+ # Allow the scheme to be accessed like a Hash.
70
+ def []( color_tag )
71
+ @scheme[to_symbol(color_tag)]
72
+ end
73
+
74
+ # Retrieve the original form of the scheme
75
+ def definition( color_tag )
76
+ style = @scheme[to_symbol(color_tag)]
77
+ style && style.list
78
+ end
79
+
80
+ # Retrieve the keys in the scheme
81
+ def keys
82
+ @scheme.keys
83
+ end
84
+
85
+ # Allow the scheme to be set like a Hash.
86
+ def []=( color_tag, constants )
87
+ @scheme[to_symbol(color_tag)] = HighLine::Style.new(:name=>color_tag.to_s.downcase.to_sym,
88
+ :list=>constants, :no_index=>true)
89
+ end
90
+
91
+ # Retrieve the color scheme hash (in original definition format)
92
+ def to_hash
93
+ @scheme.inject({}) { |hsh, pair| key, value = pair; hsh[key] = value.list; hsh }
94
+ end
95
+
96
+
97
+ private
98
+
99
+ # Return a normalized representation of a color name.
100
+ def to_symbol( t )
101
+ t.to_s.downcase
102
+ end
103
+
104
+ # Return a normalized representation of a color setting.
105
+ def to_constant( v )
106
+ v = v.to_s if v.is_a?(Symbol)
107
+ if v.is_a?(::String) then
108
+ HighLine.const_get(v.upcase)
109
+ else
110
+ v
111
+ end
112
+ end
113
+ end
114
+
115
+ # A sample ColorScheme.
116
+ class SampleColorScheme < ColorScheme
117
+ #
118
+ # Builds the sample scheme with settings for <tt>:critical</tt>,
119
+ # <tt>:error</tt>, <tt>:warning</tt>, <tt>:notice</tt>, <tt>:info</tt>,
120
+ # <tt>:debug</tt>, <tt>:row_even</tt>, and <tt>:row_odd</tt> colors.
121
+ #
122
+ def initialize( h = nil )
123
+ scheme = {
124
+ :critical => [ :yellow, :on_red ],
125
+ :error => [ :bold, :red ],
126
+ :warning => [ :bold, :yellow ],
127
+ :notice => [ :bold, :magenta ],
128
+ :info => [ :bold, :cyan ],
129
+ :debug => [ :bold, :green ],
130
+ :row_even => [ :cyan ],
131
+ :row_odd => [ :magenta ]
132
+ }
133
+ super(scheme)
134
+ end
135
+ end
136
+ end
@@ -0,0 +1,16 @@
1
+ unless STDIN.respond_to? :getbyte
2
+ class IO
3
+ alias_method :getbyte, :getc
4
+ end
5
+
6
+ class StringIO
7
+ alias_method :getbyte, :getc
8
+ end
9
+ end
10
+
11
+ unless "".respond_to? :each_line
12
+ # Not a perfect translation, but sufficient for our needs.
13
+ class String
14
+ alias_method :each_line, :each
15
+ end
16
+ end
@@ -0,0 +1,43 @@
1
+ #!/usr/local/bin/ruby -w
2
+
3
+ # import.rb
4
+ #
5
+ # Created by James Edward Gray II on 2005-04-26.
6
+ # Copyright 2005 Gray Productions. All rights reserved.
7
+ #
8
+ # This is Free Software. See LICENSE and COPYING for details.
9
+
10
+ require "highline"
11
+ require "forwardable"
12
+
13
+ $terminal = HighLine.new
14
+
15
+ #
16
+ # <tt>require "highline/import"</tt> adds shortcut methods to Kernel, making
17
+ # agree(), ask(), choose() and say() globally available. This is handy for
18
+ # quick and dirty input and output. These methods use the HighLine object in
19
+ # the global variable <tt>$terminal</tt>, which is initialized to used
20
+ # <tt>$stdin</tt> and <tt>$stdout</tt> (you are free to change this).
21
+ # Otherwise, these methods are identical to their HighLine counterparts, see that
22
+ # class for detailed explanations.
23
+ #
24
+ module Kernel
25
+ extend Forwardable
26
+ def_delegators :$terminal, :agree, :ask, :choose, :say
27
+ end
28
+
29
+ class Object
30
+ #
31
+ # Tries this object as a _first_answer_ for a HighLine::Question. See that
32
+ # attribute for details.
33
+ #
34
+ # *Warning*: This Object will be passed to String() before set.
35
+ #
36
+ def or_ask( *args, &details )
37
+ ask(*args) do |question|
38
+ question.first_answer = String(self) unless nil?
39
+
40
+ details.call(question) unless details.nil?
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,398 @@
1
+ #!/usr/local/bin/ruby -w
2
+
3
+ # menu.rb
4
+ #
5
+ # Created by Gregory Thomas Brown on 2005-05-10.
6
+ # Copyright 2005. All rights reserved.
7
+ #
8
+ # This is Free Software. See LICENSE and COPYING for details.
9
+
10
+ require "highline/question"
11
+
12
+ class HighLine
13
+ #
14
+ # Menu objects encapsulate all the details of a call to HighLine.choose().
15
+ # Using the accessors and Menu.choice() and Menu.choices(), the block passed
16
+ # to HighLine.choose() can detail all aspects of menu display and control.
17
+ #
18
+ class Menu < Question
19
+ #
20
+ # Create an instance of HighLine::Menu. All customization is done
21
+ # through the passed block, which should call accessors and choice() and
22
+ # choices() as needed to define the Menu. Note that Menus are also
23
+ # Questions, so all that functionality is available to the block as
24
+ # well.
25
+ #
26
+ def initialize( )
27
+ #
28
+ # Initialize Question objects with ignored values, we'll
29
+ # adjust ours as needed.
30
+ #
31
+ super("Ignored", [ ], &nil) # avoiding passing the block along
32
+
33
+ @items = [ ]
34
+ @hidden_items = [ ]
35
+ @help = Hash.new("There's no help for that topic.")
36
+
37
+ @index = :number
38
+ @index_suffix = ". "
39
+ @select_by = :index_or_name
40
+ @flow = :rows
41
+ @list_option = nil
42
+ @header = nil
43
+ @prompt = "? "
44
+ @layout = :list
45
+ @shell = false
46
+ @nil_on_handled = false
47
+
48
+ # Override Questions responses, we'll set our own.
49
+ @responses = { }
50
+ # Context for action code.
51
+ @highline = nil
52
+
53
+ yield self if block_given?
54
+
55
+ init_help if @shell and not @help.empty?
56
+ end
57
+
58
+ #
59
+ # An _index_ to append to each menu item in display. See
60
+ # Menu.index=() for details.
61
+ #
62
+ attr_reader :index
63
+ #
64
+ # The String placed between an _index_ and a menu item. Defaults to
65
+ # ". ". Switches to " ", when _index_ is set to a String (like "-").
66
+ #
67
+ attr_accessor :index_suffix
68
+ #
69
+ # The _select_by_ attribute controls how the user is allowed to pick a
70
+ # menu item. The available choices are:
71
+ #
72
+ # <tt>:index</tt>:: The user is allowed to type the numerical
73
+ # or alphetical index for their selection.
74
+ # <tt>:index_or_name</tt>:: Allows both methods from the
75
+ # <tt>:index</tt> option and the
76
+ # <tt>:name</tt> option.
77
+ # <tt>:name</tt>:: Menu items are selected by typing a portion
78
+ # of the item name that will be
79
+ # auto-completed.
80
+ #
81
+ attr_accessor :select_by
82
+ #
83
+ # This attribute is passed directly on as the mode to HighLine.list() by
84
+ # all the preset layouts. See that method for appropriate settings.
85
+ #
86
+ attr_accessor :flow
87
+ #
88
+ # This setting is passed on as the third parameter to HighLine.list()
89
+ # by all the preset layouts. See that method for details of its
90
+ # effects. Defaults to +nil+.
91
+ #
92
+ attr_accessor :list_option
93
+ #
94
+ # Used by all the preset layouts to display title and/or introductory
95
+ # information, when set. Defaults to +nil+.
96
+ #
97
+ attr_accessor :header
98
+ #
99
+ # Used by all the preset layouts to ask the actual question to fetch a
100
+ # menu selection from the user. Defaults to "? ".
101
+ #
102
+ attr_accessor :prompt
103
+ #
104
+ # An ERb _layout_ to use when displaying this Menu object. See
105
+ # Menu.layout=() for details.
106
+ #
107
+ attr_reader :layout
108
+ #
109
+ # When set to +true+, responses are allowed to be an entire line of
110
+ # input, including details beyond the command itself. Only the first
111
+ # "word" of input will be matched against the menu choices, but both the
112
+ # command selected and the rest of the line will be passed to provided
113
+ # action blocks. Defaults to +false+.
114
+ #
115
+ attr_accessor :shell
116
+ #
117
+ # When +true+, any selected item handled by provided action code, will
118
+ # return +nil+, instead of the results to the action code. This may
119
+ # prove handy when dealing with mixed menus where only the names of
120
+ # items without any code (and +nil+, of course) will be returned.
121
+ # Defaults to +false+.
122
+ #
123
+ attr_accessor :nil_on_handled
124
+
125
+ #
126
+ # Adds _name_ to the list of available menu items. Menu items will be
127
+ # displayed in the order they are added.
128
+ #
129
+ # An optional _action_ can be associated with this name and if provided,
130
+ # it will be called if the item is selected. The result of the method
131
+ # will be returned, unless _nil_on_handled_ is set (when you would get
132
+ # +nil+ instead). In _shell_ mode, a provided block will be passed the
133
+ # command chosen and any details that followed the command. Otherwise,
134
+ # just the command is passed. The <tt>@highline</tt> variable is set to
135
+ # the current HighLine context before the action code is called and can
136
+ # thus be used for adding output and the like.
137
+ #
138
+ def choice( name, help = nil, &action )
139
+ @items << [name, action]
140
+
141
+ @help[name.to_s.downcase] = help unless help.nil?
142
+ update_responses # rebuild responses based on our settings
143
+ end
144
+
145
+ #
146
+ # A shortcut for multiple calls to the sister method choice(). <b>Be
147
+ # warned:</b> An _action_ set here will apply to *all* provided
148
+ # _names_. This is considered to be a feature, so you can easily
149
+ # hand-off interface processing to a different chunk of code.
150
+ #
151
+ def choices( *names, &action )
152
+ names.each { |n| choice(n, &action) }
153
+ end
154
+
155
+ # Identical to choice(), but the item will not be listed for the user.
156
+ def hidden( name, help = nil, &action )
157
+ @hidden_items << [name, action]
158
+
159
+ @help[name.to_s.downcase] = help unless help.nil?
160
+ end
161
+
162
+ #
163
+ # Sets the indexing style for this Menu object. Indexes are appended to
164
+ # menu items, when displayed in list form. The available settings are:
165
+ #
166
+ # <tt>:number</tt>:: Menu items will be indexed numerically, starting
167
+ # with 1. This is the default method of indexing.
168
+ # <tt>:letter</tt>:: Items will be indexed alphabetically, starting
169
+ # with a.
170
+ # <tt>:none</tt>:: No index will be appended to menu items.
171
+ # <i>any String</i>:: Will be used as the literal _index_.
172
+ #
173
+ # Setting the _index_ to <tt>:none</tt> a literal String, also adjusts
174
+ # _index_suffix_ to a single space and _select_by_ to <tt>:none</tt>.
175
+ # Because of this, you should make a habit of setting the _index_ first.
176
+ #
177
+ def index=( style )
178
+ @index = style
179
+
180
+ # Default settings.
181
+ if @index == :none or @index.is_a?(::String)
182
+ @index_suffix = " "
183
+ @select_by = :name
184
+ end
185
+ end
186
+
187
+ #
188
+ # Initializes the help system by adding a <tt>:help</tt> choice, some
189
+ # action code, and the default help listing.
190
+ #
191
+ def init_help( )
192
+ return if @items.include?(:help)
193
+
194
+ topics = @help.keys.sort
195
+ help_help = @help.include?("help") ? @help["help"] :
196
+ "This command will display helpful messages about " +
197
+ "functionality, like this one. To see the help for " +
198
+ "a specific topic enter:\n\thelp [TOPIC]\nTry asking " +
199
+ "for help on any of the following:\n\n" +
200
+ "<%= list(#{topics.inspect}, :columns_across) %>"
201
+ choice(:help, help_help) do |command, topic|
202
+ topic.strip!
203
+ topic.downcase!
204
+ if topic.empty?
205
+ @highline.say(@help["help"])
206
+ else
207
+ @highline.say("= #{topic}\n\n#{@help[topic]}")
208
+ end
209
+ end
210
+ end
211
+
212
+ #
213
+ # Used to set help for arbitrary topics. Use the topic <tt>"help"</tt>
214
+ # to override the default message.
215
+ #
216
+ def help( topic, help )
217
+ @help[topic] = help
218
+ end
219
+
220
+ #
221
+ # Setting a _layout_ with this method also adjusts some other attributes
222
+ # of the Menu object, to ideal defaults for the chosen _layout_. To
223
+ # account for that, you probably want to set a _layout_ first in your
224
+ # configuration block, if needed.
225
+ #
226
+ # Accepted settings for _layout_ are:
227
+ #
228
+ # <tt>:list</tt>:: The default _layout_. The _header_ if set
229
+ # will appear at the top on its own line with
230
+ # a trailing colon. Then the list of menu
231
+ # items will follow. Finally, the _prompt_
232
+ # will be used as the ask()-like question.
233
+ # <tt>:one_line</tt>:: A shorter _layout_ that fits on one line.
234
+ # The _header_ comes first followed by a
235
+ # colon and spaces, then the _prompt_ with menu
236
+ # items between trailing parenthesis.
237
+ # <tt>:menu_only</tt>:: Just the menu items, followed up by a likely
238
+ # short _prompt_.
239
+ # <i>any ERb String</i>:: Will be taken as the literal _layout_. This
240
+ # String can access <tt>@header</tt>,
241
+ # <tt>@menu</tt> and <tt>@prompt</tt>, but is
242
+ # otherwise evaluated in the typical HighLine
243
+ # context, to provide access to utilities like
244
+ # HighLine.list() primarily.
245
+ #
246
+ # If set to either <tt>:one_line</tt>, or <tt>:menu_only</tt>, _index_
247
+ # will default to <tt>:none</tt> and _flow_ will default to
248
+ # <tt>:inline</tt>.
249
+ #
250
+ def layout=( new_layout )
251
+ @layout = new_layout
252
+
253
+ # Default settings.
254
+ case @layout
255
+ when :one_line, :menu_only
256
+ self.index = :none
257
+ @flow = :inline
258
+ end
259
+ end
260
+
261
+ #
262
+ # This method returns all possible options for auto-completion, based
263
+ # on the settings of _index_ and _select_by_.
264
+ #
265
+ def options( )
266
+ # add in any hidden menu commands
267
+ @items.concat(@hidden_items)
268
+
269
+ by_index = if @index == :letter
270
+ l_index = "`"
271
+ @items.map { "#{l_index.succ!}" }
272
+ else
273
+ (1 .. @items.size).collect { |s| String(s) }
274
+ end
275
+ by_name = @items.collect { |c| c.first }
276
+
277
+ case @select_by
278
+ when :index then
279
+ by_index
280
+ when :name
281
+ by_name
282
+ else
283
+ by_index + by_name
284
+ end
285
+ ensure
286
+ # make sure the hidden items are removed, before we return
287
+ @items.slice!(@items.size - @hidden_items.size, @hidden_items.size)
288
+ end
289
+
290
+ #
291
+ # This method processes the auto-completed user selection, based on the
292
+ # rules for this Menu object. If an action was provided for the
293
+ # selection, it will be executed as described in Menu.choice().
294
+ #
295
+ def select( highline_context, selection, details = nil )
296
+ # add in any hidden menu commands
297
+ @items.concat(@hidden_items)
298
+
299
+ # Find the selected action.
300
+ name, action = if selection =~ /^\d+$/
301
+ @items[selection.to_i - 1]
302
+ else
303
+ l_index = "`"
304
+ index = @items.map { "#{l_index.succ!}" }.index(selection)
305
+ @items.find { |c| c.first == selection } or @items[index]
306
+ end
307
+
308
+ # Run or return it.
309
+ if not action.nil?
310
+ @highline = highline_context
311
+ if @shell
312
+ result = action.call(name, details)
313
+ else
314
+ result = action.call(name)
315
+ end
316
+ @nil_on_handled ? nil : result
317
+ elsif action.nil?
318
+ name
319
+ else
320
+ nil
321
+ end
322
+ ensure
323
+ # make sure the hidden items are removed, before we return
324
+ @items.slice!(@items.size - @hidden_items.size, @hidden_items.size)
325
+ end
326
+
327
+ #
328
+ # Allows Menu objects to pass as Arrays, for use with HighLine.list().
329
+ # This method returns all menu items to be displayed, complete with
330
+ # indexes.
331
+ #
332
+ def to_ary( )
333
+ case @index
334
+ when :number
335
+ @items.map { |c| "#{@items.index(c) + 1}#{@index_suffix}#{c.first}" }
336
+ when :letter
337
+ l_index = "`"
338
+ @items.map { |c| "#{l_index.succ!}#{@index_suffix}#{c.first}" }
339
+ when :none
340
+ @items.map { |c| "#{c.first}" }
341
+ else
342
+ @items.map { |c| "#{index}#{@index_suffix}#{c.first}" }
343
+ end
344
+ end
345
+
346
+ #
347
+ # Allows Menu to behave as a String, just like Question. Returns the
348
+ # _layout_ to be rendered, which is used by HighLine.say().
349
+ #
350
+ def to_str( )
351
+ case @layout
352
+ when :list
353
+ '<%= if @header.nil? then '' else "#{@header}:\n" end %>' +
354
+ "<%= list( @menu, #{@flow.inspect},
355
+ #{@list_option.inspect} ) %>" +
356
+ "<%= @prompt %>"
357
+ when :one_line
358
+ '<%= if @header.nil? then '' else "#{@header}: " end %>' +
359
+ "<%= @prompt %>" +
360
+ "(<%= list( @menu, #{@flow.inspect},
361
+ #{@list_option.inspect} ) %>)" +
362
+ "<%= @prompt[/\s*$/] %>"
363
+ when :menu_only
364
+ "<%= list( @menu, #{@flow.inspect},
365
+ #{@list_option.inspect} ) %><%= @prompt %>"
366
+ else
367
+ @layout
368
+ end
369
+ end
370
+
371
+ #
372
+ # This method will update the intelligent responses to account for
373
+ # Menu specific differences. This overrides the work done by
374
+ # Question.build_responses().
375
+ #
376
+ def update_responses( )
377
+ append_default unless default.nil?
378
+ @responses = @responses.merge(
379
+ :ambiguous_completion =>
380
+ "Ambiguous choice. " +
381
+ "Please choose one of #{options.inspect}.",
382
+ :ask_on_error =>
383
+ "? ",
384
+ :invalid_type =>
385
+ "You must enter a valid #{options}.",
386
+ :no_completion =>
387
+ "You must choose one of " +
388
+ "#{options.inspect}.",
389
+ :not_in_range =>
390
+ "Your answer isn't within the expected range " +
391
+ "(#{expected_range}).",
392
+ :not_valid =>
393
+ "Your answer isn't valid (must match " +
394
+ "#{@validate.inspect})."
395
+ )
396
+ end
397
+ end
398
+ end