Class: Quiver::Adapter::Local
- Inherits:
-
Object
- Object
- Quiver::Adapter::Local
- Defined in:
- lib/quiver/adapter/local.rb
Instance Method Summary collapse
- #each(path, ext) ⇒ Object
- #image_url(path) ⇒ Object
-
#initialize(root) ⇒ Local
constructor
A new instance of Local.
- #load(path) ⇒ Object
- #mkpath(path) ⇒ Object
- #save(path, content) ⇒ Object
Constructor Details
Instance Method Details
#each(path, ext) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/quiver/adapter/local.rb', line 10 def each(path, ext) @root.join(path).each_child(false) do |entry| next unless entry.to_s.end_with?(".#{ext}") yield entry end end |
#image_url(path) ⇒ Object
7 8 9 |
# File 'lib/quiver/adapter/local.rb', line 7 def image_url(path) "file://" + path.to_s end |
#load(path) ⇒ Object
16 17 18 |
# File 'lib/quiver/adapter/local.rb', line 16 def load(path) File.read @root.join(path) end |
#mkpath(path) ⇒ Object
19 20 21 |
# File 'lib/quiver/adapter/local.rb', line 19 def mkpath(path) @root.join(path).mkpath end |
#save(path, content) ⇒ Object
22 23 24 |
# File 'lib/quiver/adapter/local.rb', line 22 def save(path, content) @root.join(path).write(content) end |