Don't use Ruby 1.9-only code

This commit is contained in:
Mitchell Hashimoto 2010-09-27 12:01:56 -07:00
parent f47c59d4ba
commit caa80d54ac
1 changed files with 11 additions and 7 deletions

View File

@ -26,16 +26,20 @@ module Vagrant
end end
[[:warn, :yellow], [:error, :red], [:info, nil], [:confirm, :green]].each do |method, color| [[:warn, :yellow], [:error, :red], [:info, nil], [:confirm, :green]].each do |method, color|
define_method(method) do |message, opts=nil| class_eval <<-CODE
@shell.say("#{line_reset}#{format_message(message, opts)}", color) def #{method}(message, opts=nil)
@shell.say("\#{line_reset}\#{format_message(message, opts)}", color)
end end
CODE
end end
[:ask, :no?, :yes?].each do |method| [:ask, :no?, :yes?].each do |method|
define_method(method) do |message, opts=nil| class_eval <<-CODE
def #{method}(message, opts=nil)
opts ||= {} opts ||= {}
@shell.send(method, format_message(message, opts), opts[:color]) @shell.send(method, format_message(message, opts), opts[:color])
end end
CODE
end end
def report_progress(progress, total, show_parts=true) def report_progress(progress, total, show_parts=true)