Class: Configuration::OutputMultiBase::OutputSpec
- Inherits:
-
Object
- Object
- Configuration::OutputMultiBase::OutputSpec
- Includes:
- ConditionalInclusion
- Defined in:
- lib/httpimagestore/configuration/output.rb
Instance Attribute Summary collapse
-
#image_name ⇒ Object
readonly
Returns the value of attribute image_name.
-
#path_spec ⇒ Object
readonly
Returns the value of attribute path_spec.
Instance Method Summary collapse
-
#initialize(global, image_name, path_spec, matcher) ⇒ OutputSpec
constructor
A new instance of OutputSpec.
- #store_path(request_state) ⇒ Object
- #store_url(request_state) ⇒ Object
Methods included from ConditionalInclusion
#excluded?, #included?, #inclusion_matcher
Constructor Details
#initialize(global, image_name, path_spec, matcher) ⇒ OutputSpec
Returns a new instance of OutputSpec.
72 73 74 75 76 77 |
# File 'lib/httpimagestore/configuration/output.rb', line 72 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_name ⇒ Object (readonly)
Returns the value of attribute image_name.
69 70 71 |
# File 'lib/httpimagestore/configuration/output.rb', line 69 def image_name @image_name end |
#path_spec ⇒ Object (readonly)
Returns the value of attribute path_spec.
70 71 72 |
# File 'lib/httpimagestore/configuration/output.rb', line 70 def path_spec @path_spec end |
Instance Method Details
#store_path(request_state) ⇒ Object
79 80 81 82 83 |
# File 'lib/httpimagestore/configuration/output.rb', line 79 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
85 86 87 88 89 90 91 |
# File 'lib/httpimagestore/configuration/output.rb', line 85 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 |