Class: Mosaico::LocalBackend
- Inherits:
-
Object
- Object
- Mosaico::LocalBackend
- Defined in:
- lib/mosaico/local_backend.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#base_path ⇒ Object
readonly
Returns the value of attribute base_path.
-
#base_url ⇒ Object
readonly
Returns the value of attribute base_url.
Instance Method Summary collapse
-
#initialize(base_path, base_url) ⇒ LocalBackend
constructor
A new instance of LocalBackend.
- #retrieve(filename) ⇒ Object
- #store(source, as:) ⇒ Object
- #url_to(filename) ⇒ Object
Constructor Details
#initialize(base_path, base_url) ⇒ LocalBackend
Returns a new instance of 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 (readonly)
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 (readonly)
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 |