Class: Configuration::FileStore
- Inherits:
-
FileSourceStoreBase
- Object
- SourceStoreBase
- FileSourceStoreBase
- Configuration::FileStore
- Includes:
- ClassLogging
- Defined in:
- lib/httpimagestore/configuration/file.rb
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from FileSourceStoreBase
#initialize, #storage_path, #to_s
Methods inherited from SourceStoreBase
Methods included from ConditionalInclusion
#excluded?, #included?, #inclusion_matcher
Constructor Details
This class inherits a constructor from Configuration::FileSourceStoreBase
Class Method Details
.match(node) ⇒ Object
103 104 105 |
# File 'lib/httpimagestore/configuration/file.rb', line 103 def self.match(node) node.name == 'store_file' end |
.parse(configuration, node) ⇒ Object
107 108 109 |
# File 'lib/httpimagestore/configuration/file.rb', line 107 def self.parse(configuration, node) configuration.stores << super end |
Instance Method Details
#realize(request_state) ⇒ Object
111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/httpimagestore/configuration/file.rb', line 111 def realize(request_state) get_named_image_for_storage(request_state) do |image_name, image, rendered_path| storage_path = storage_path(rendered_path) image.store_url = "file://#{URI.encode(rendered_path.to_s)}" log.info "storing '#{image_name}' in file '#{storage_path}' (#{image.data.length} bytes)" storage_path.open('wb'){|io| io.write image.data} FileSourceStoreBase.stats.incr_total_file_store FileSourceStoreBase.stats.incr_total_file_store_bytes(image.data.bytesize) end end |