Class: Configuration::OutputMultiBase

Inherits:
Object
  • Object
show all
Defined in:
lib/httpimagestore/configuration/output.rb

Direct Known Subclasses

OutputStorePath, OutputStoreURL

Defined Under Namespace

Classes: OutputSpec

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(output_specs) ⇒ OutputMultiBase

Returns a new instance of OutputMultiBase.



117
118
119
# File 'lib/httpimagestore/configuration/output.rb', line 117

def initialize(output_specs)
	@output_specs = output_specs
end

Class Method Details

.parse(configuration, node) ⇒ Object



104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/httpimagestore/configuration/output.rb', line 104

def self.parse(configuration, node)
	nodes = node.values.empty? ? node.children : [node]
	output_specs = nodes.map do |node|
		image_name = node.grab_values('image name').first
		path_spec, if_image_name_on = *node.grab_attributes('path', 'if-image-name-on')
		matcher = InclusionMatcher.new(image_name, if_image_name_on)
		OutputSpec.new(configuration.global, image_name, path_spec, matcher)
	end

	configuration.output and raise StatementCollisionError.new(node, 'output')
	configuration.output = self.new(output_specs)
end