Class: Configuration::OutputMultiBase

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

Direct Known Subclasses

OutputStorePath, OutputStoreURI, 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.



124
125
126
# File 'lib/httpimagestore/configuration/output.rb', line 124

def initialize(output_specs)
	@output_specs = output_specs
end

Class Method Details

.parse(configuration, node) ⇒ Object



111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/httpimagestore/configuration/output.rb', line 111

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
		scheme, host, port, path_spec, if_image_name_on = *node.grab_attributes('scheme', 'host', 'port', 'path', 'if-image-name-on')
		matcher = InclusionMatcher.new(image_name, if_image_name_on)
		OutputSpec.new(configuration.global, image_name, scheme, host, port, path_spec, matcher)
	end

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