Added ability for methods to be overrode, through the pretend and quiet

options, skipping their default behaviour if so.
This commit is contained in:
Jeremy Cook
2014-04-20 10:52:30 -04:00
parent b5138bcdd1
commit d4f9633a0c
5 changed files with 67 additions and 51 deletions

View File

@@ -2,6 +2,22 @@
module Homesick
# Various utility methods that are used by Homesick
module Utils
QUIETABLE = ['say_status']
PRETENDABLE = ['system']
QUIETABLE.each do |method_name|
define_method(method_name) do |*args|
super(*args) unless options[:quiet]
end
end
PRETENDABLE.each do |method_name|
define_method(method_name) do |*args|
super(*args) unless options[:pretend]
end
end
protected
def home_dir