Class: Staticd::Datastore
- Inherits:
-
Object
- Object
- Staticd::Datastore
- Includes:
- Singleton
- Defined in:
- lib/staticd/datastore.rb
Overview
Load the corresponding datastore driver from an URL.
This class use an URL to choose wich datastore library to use. It create a datastore instance with the correct driver and proxies its calls to it. It use the URL scheme to guess wich datastore library to use.
Example:
Staticd::Datastore.setup("s3://[...]") # Staticd::Datastores::S3
Staticd::Datastore.setup("local:/[...]") # Staticd::Datastores::Local
Staticd::Datastore.put(file_path)
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.exist?(file_path) ⇒ Boolean
33 34 35 |
# File 'lib/staticd/datastore.rb', line 33 def self.exist?(file_path) instance.exist?(file_path) end |
.put(file_path) ⇒ Object
29 30 31 |
# File 'lib/staticd/datastore.rb', line 29 def self.put(file_path) instance.put(file_path) end |
.setup(url) ⇒ Object
25 26 27 |
# File 'lib/staticd/datastore.rb', line 25 def self.setup(url) instance.setup(url) end |
Instance Method Details
#exist?(file_path) ⇒ Boolean
45 46 47 |
# File 'lib/staticd/datastore.rb', line 45 def exist?(file_path) datastore.exist?(file_path) end |
#put(file_path) ⇒ Object
41 42 43 |
# File 'lib/staticd/datastore.rb', line 41 def put(file_path) datastore.put(file_path) end |
#setup(url) ⇒ Object
37 38 39 |
# File 'lib/staticd/datastore.rb', line 37 def setup(url) @uri = URI(url) end |