class Svgeez::Destination

Constants

DEFAULT_DESTINATION_FILE_NAME

Public Class Methods

new(options = {}) click to toggle source
# File lib/svgeez/destination.rb, line 5
def initialize(options = {})
  @destination = File.expand_path(options.fetch('destination', "./#{DEFAULT_DESTINATION_FILE_NAME}"))
end

Public Instance Methods

file_id() click to toggle source
# File lib/svgeez/destination.rb, line 9
def file_id
  @file_id ||= File.basename(file_name, '.svg').tr(' ', '-')
end
file_name() click to toggle source
# 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() click to toggle source
# File lib/svgeez/destination.rb, line 22
def file_path
  @file_path ||= File.join(folder_path, file_name)
end
folder_path() click to toggle source
# 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