Class: Svgeez::Destination
- Inherits:
-
Object
- Object
- Svgeez::Destination
- Defined in:
- lib/svgeez/destination.rb
Constant Summary collapse
- DEFAULT_DESTINATION_FILE_NAME =
'svgeez.svg'.freeze
Instance Method Summary collapse
- #file_id ⇒ Object
- #file_name ⇒ Object
- #file_path ⇒ Object
- #folder_path ⇒ Object
-
#initialize(options = {}) ⇒ Destination
constructor
A new instance of Destination.
Constructor Details
#initialize(options = {}) ⇒ Destination
Returns a new instance of Destination.
5 6 7 |
# File 'lib/svgeez/destination.rb', line 5 def initialize( = {}) @destination = File.(.fetch('destination', "./#{DEFAULT_DESTINATION_FILE_NAME}")) end |
Instance Method Details
#file_id ⇒ Object
9 10 11 |
# File 'lib/svgeez/destination.rb', line 9 def file_id @file_id ||= File.basename(file_name, '.svg').tr(' ', '-') end |
#file_name ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/svgeez/destination.rb', line 13 def file_name @file_name ||= if @destination.end_with?('.svg') File.split(@destination)[1] else DEFAULT_DESTINATION_FILE_NAME end end |
#file_path ⇒ Object
22 23 24 |
# File 'lib/svgeez/destination.rb', line 22 def file_path @file_path ||= File.join(folder_path, file_name) end |
#folder_path ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/svgeez/destination.rb', line 26 def folder_path @folder_path ||= if @destination.end_with?('.svg') File.split(@destination)[0] else @destination end end |