class Relinker::Application
Attributes
dir[R]
options[R]
Public Class Methods
new(dir, options = {})
click to toggle source
# File lib/relinker/application.rb, line 5 def initialize(dir, options = {}) @dir = dir @options = merge_options(options) end
Public Instance Methods
run()
click to toggle source
# File lib/relinker/application.rb, line 10 def run discoverer.collect(@dir) linker.relink_identicals end
Private Instance Methods
cache_dir()
click to toggle source
# File lib/relinker/application.rb, line 29 def cache_dir options[:cache_dir] end
cache_file()
click to toggle source
# File lib/relinker/application.rb, line 25 def cache_file @_cache_file ||= "#{cache_dir}/relinker_cache_#{Time.now.to_i}" end
default_options()
click to toggle source
# File lib/relinker/application.rb, line 38 def default_options { cache_dir: "/tmp" } end
discoverer()
click to toggle source
# File lib/relinker/application.rb, line 17 def discoverer @_discoverer ||= Discoverer.new(cache_file, @options) end
linker()
click to toggle source
# File lib/relinker/application.rb, line 21 def linker @_linker ||= Linker.new(cache_file, @options) end
merge_options(options = {})
click to toggle source
# File lib/relinker/application.rb, line 33 def merge_options(options = {}) options = options.map { |key, val| [key.to_sym, val] }.to_h default_options.merge(options) end