Refactor with Forwardable module

This commit is contained in:
Thibault Jouan
2014-11-17 21:44:15 +00:00
parent af1bb97287
commit 86a84bbe12
5 changed files with 15 additions and 32 deletions

View File

@@ -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