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