Refactor with Forwardable module
This commit is contained in:
@@ -14,7 +14,9 @@ module Producer
|
||||
end
|
||||
|
||||
extend Forwardable
|
||||
def_delegators :@env, :target
|
||||
def_delegators :@name, :to_s
|
||||
def_delegators :@env, :target
|
||||
def_delegator :@env, :[], :get
|
||||
|
||||
define_action :echo, Actions::Echo
|
||||
define_action :sh, Actions::ShellCommand
|
||||
@@ -34,10 +36,6 @@ module Producer
|
||||
@condition = condition
|
||||
end
|
||||
|
||||
def to_s
|
||||
@name.to_s
|
||||
end
|
||||
|
||||
def condition_met?
|
||||
!!@condition
|
||||
end
|
||||
@@ -55,10 +53,6 @@ module Producer
|
||||
prompter.prompt(question, choices)
|
||||
end
|
||||
|
||||
def get(key)
|
||||
@env[key]
|
||||
end
|
||||
|
||||
def template(path, variables = {})
|
||||
Template.new(path).render variables
|
||||
end
|
||||
|
Reference in New Issue
Block a user