Class: Configuration::OutputMultiBase::OutputSpec

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ConditionalInclusion

#excluded?, #included?, #inclusion_matcher

Constructor Details

#initialize(global, image_name, path_spec, matcher) ⇒ OutputSpec

Returns a new instance of OutputSpec.



71
72
73
74
75
76
# File 'lib/httpimagestore/configuration/output.rb', line 71

def initialize(global, image_name, path_spec, matcher)
	@global = global
	@image_name = image_name
	@path_spec = path_spec
	inclusion_matcher matcher
end

Instance Attribute Details

#image_nameObject (readonly)

Returns the value of attribute image_name.



68
69
70
# File 'lib/httpimagestore/configuration/output.rb', line 68

def image_name
  @image_name
end

#path_specObject (readonly)

Returns the value of attribute path_spec.



69
70
71
# File 'lib/httpimagestore/configuration/output.rb', line 69

def path_spec
  @path_spec
end

Instance Method Details

#store_path(request_state) ⇒ Object



78
79
80
81
82
# File 'lib/httpimagestore/configuration/output.rb', line 78

def store_path(request_state)
	store_path = request_state.images[@image_name].store_path or raise StorePathNotSetForImage.new(@image_name)
	return store_path unless @path_spec
	rendered_path(store_path, request_state)
end

#store_url(request_state) ⇒ Object



84
85
86
87
88
89
90
# File 'lib/httpimagestore/configuration/output.rb', line 84

def store_url(request_state)
	store_url = request_state.images[@image_name].store_url or raise StoreURLNotSetForImage.new(@image_name)
	return store_url unless @path_spec
	uri = URI(store_url)
	uri.path = '/' + URI.encode(rendered_path(URI.decode(uri.path), request_state))
	uri
end