Class: Rack::Acme::FileCache
- Inherits:
-
Object
- Object
- Rack::Acme::FileCache
- Defined in:
- lib/rack/acme/file_cache.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
- #[](token) ⇒ Object
- #[]=(token, value) ⇒ Object
-
#initialize(path) ⇒ FileCache
constructor
A new instance of FileCache.
Constructor Details
#initialize(path) ⇒ FileCache
Returns a new instance of FileCache.
7 8 9 |
# File 'lib/rack/acme/file_cache.rb', line 7 def initialize(path) @path = path end |
Instance Attribute Details
#path ⇒ Object
Returns the value of attribute path.
5 6 7 |
# File 'lib/rack/acme/file_cache.rb', line 5 def path @path end |
Instance Method Details
#[](token) ⇒ Object
11 12 13 14 15 |
# File 'lib/rack/acme/file_cache.rb', line 11 def [](token) dest = File.(token, path) File.read(dest) if File.exists?(dest) end |
#[]=(token, value) ⇒ Object
17 18 19 20 21 |
# File 'lib/rack/acme/file_cache.rb', line 17 def []=(token, value) dest = File.(token, path) File.write(dest, value) end |