Class: Moneta::Transforms::Spread
- Inherits:
-
Moneta::Transform
- Object
- Moneta::Transform
- Moneta::Transforms::Spread
- Defined in:
- lib/moneta/transforms/spread.rb
Overview
Transforms strings by inserting a “/” character after the first two characters, using File.join. This can be used with the Adapters::File adapter to spread files into subdirectories. The :HashFile
option on Moneta.new uses this transform (in conjunction with MD5) - see README.
Instance Method Summary collapse
Methods inherited from Moneta::Transform
#decodable?, #decode, delegate_to, #initialize, #method_missing, #respond_to_missing?
Constructor Details
This class inherits a constructor from Moneta::Transform
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Moneta::Transform
Instance Method Details
#encode(value) ⇒ String
17 18 19 |
# File 'lib/moneta/transforms/spread.rb', line 17 def encode(value) ::File.join(value[0..1], value [2..-1]) end |