summaryrefslogtreecommitdiff
path: root/lib/oxidized/model/model.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/oxidized/model/model.rb')
-rw-r--r--lib/oxidized/model/model.rb17
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/oxidized/model/model.rb b/lib/oxidized/model/model.rb
index af86f1d..3dd3f98 100644
--- a/lib/oxidized/model/model.rb
+++ b/lib/oxidized/model/model.rb
@@ -79,16 +79,15 @@ module Oxidized
def cmd string, &block
out = @input.cmd string
return false unless out
- out = Oxidized::String.new out
self.class.cmds[:all].each do |all_block|
- out = instance_exec out, string, &all_block
+ out = instance_exec Oxidized::String.new(out), string, &all_block
end
if vars :remove_secret
self.class.cmds[:secret].each do |all_block|
- out = instance_exec out, string, &all_block
+ out = instance_exec Oxidized::String.new(out), string, &all_block
end
end
- out = instance_exec out, &block if block
+ out = instance_exec Oxidized::String.new(out), &block if block
process_cmd_output out, string
end
@@ -152,12 +151,12 @@ module Oxidized
private
- def process_cmd_output cmd, name
- if Hash === cmd
- cmd[:name] = name
- return cmd
+ def process_cmd_output output, name
+ if output.class != Oxidized::String
+ output = Oxidized::String.new output
end
- {:output=>cmd, :type=>'cfg', :name=>name}
+ output.cmd = name
+ output
end
end