Class: Mosaico::LocalBackend
- Inherits:
-
Object
- Object
- Mosaico::LocalBackend
show all
- Defined in:
- lib/mosaico/local_backend.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(base_path, base_url) ⇒ LocalBackend
5
6
7
8
|
# File 'lib/mosaico/local_backend.rb', line 5
def initialize(base_path, base_url)
@base_path = base_path
@base_url = base_url
end
|
Instance Attribute Details
#base_path ⇒ Object
Returns the value of attribute base_path.
3
4
5
|
# File 'lib/mosaico/local_backend.rb', line 3
def base_path
@base_path
end
|
#base_url ⇒ Object
Returns the value of attribute base_url.
3
4
5
|
# File 'lib/mosaico/local_backend.rb', line 3
def base_url
@base_url
end
|
Instance Method Details
#retrieve(filename) ⇒ Object
15
16
17
|
# File 'lib/mosaico/local_backend.rb', line 15
def retrieve(filename)
File.join(base_path, filename)
end
|
#store(source, as:) ⇒ Object
10
11
12
13
|
# File 'lib/mosaico/local_backend.rb', line 10
def store(source, as:)
FileUtils.mkdir_p(base_path)
FileUtils.cp(source, File.join(base_path, as))
end
|
#url_to(filename) ⇒ Object
19
20
21
|
# File 'lib/mosaico/local_backend.rb', line 19
def url_to(filename)
Mosaico.url_join(base_url, filename)
end
|