class Orchestra::Step::Output
Attributes
hsh[RW]
Public Class Methods
new(step, raw)
click to toggle source
# File lib/orchestra/step/output.rb, line 12 def initialize step, raw @step = step @raw = raw end
process(step, raw)
click to toggle source
# File lib/orchestra/step/output.rb, line 6 def self.process step, raw instance = new step, raw instance.massage instance.hsh end
Public Instance Methods
all_provisions_supplied?(hsh = @hsh)
click to toggle source
# File lib/orchestra/step/output.rb, line 39 def all_provisions_supplied? hsh = @hsh provisions.all? &included_in_output(hsh) end
coerce_to_hash()
click to toggle source
# File lib/orchestra/step/output.rb, line 32 def coerce_to_hash return Hash(raw) unless provisions.size == 1 return raw if all_provisions_supplied? raw if raw.kind_of? Hash raise MissingProvisionError.new provisions if raw.nil? { provisions.first => raw } end
collection?()
click to toggle source
# File lib/orchestra/step/output.rb, line 21 def collection? step.collection? end
ensure_all_provisions_supplied!()
click to toggle source
# File lib/orchestra/step/output.rb, line 55 def ensure_all_provisions_supplied! return if all_provisions_supplied? raise MissingProvisionError.new missing_provisions end
included_in_output(hsh = @hsh)
click to toggle source
# File lib/orchestra/step/output.rb, line 47 def included_in_output hsh = @hsh hsh.keys.method :include? end
massage()
click to toggle source
# File lib/orchestra/step/output.rb, line 25 def massage @raw.compact! if collection? @hsh = coerce_to_hash prune ensure_all_provisions_supplied! end
missing_provisions()
click to toggle source
# File lib/orchestra/step/output.rb, line 43 def missing_provisions provisions.reject &included_in_output end
provisions()
click to toggle source
# File lib/orchestra/step/output.rb, line 17 def provisions step.provisions end
prune()
click to toggle source
# File lib/orchestra/step/output.rb, line 51 def prune hsh.select! do |key, _| provisions.include? key end end