Class: Ace::Compressor::Molecules::InputResolver
- Inherits:
-
Object
- Object
- Ace::Compressor::Molecules::InputResolver
- Defined in:
- lib/ace/compressor/molecules/input_resolver.rb
Constant Summary collapse
- CONFIG_EXTENSIONS =
%w[.yml .yaml].freeze
Instance Method Summary collapse
- #call ⇒ Object
- #cleanup ⇒ Object
-
#initialize(inputs, shell_runner: nil, temp_root: nil) ⇒ InputResolver
constructor
A new instance of InputResolver.
Constructor Details
#initialize(inputs, shell_runner: nil, temp_root: nil) ⇒ InputResolver
Returns a new instance of InputResolver.
13 14 15 16 17 18 |
# File 'lib/ace/compressor/molecules/input_resolver.rb', line 13 def initialize(inputs, shell_runner: nil, temp_root: nil) @inputs = Array(inputs) @shell_runner = shell_runner || method(:default_shell_runner) @temp_root = temp_root || Dir.mktmpdir("ace_compressor_inputs") @owns_temp_root = temp_root.nil? end |
Instance Method Details
#call ⇒ Object
20 21 22 23 24 |
# File 'lib/ace/compressor/molecules/input_resolver.rb', line 20 def call @inputs.map.with_index do |raw_input, index| resolve_one(raw_input.to_s, index) end end |
#cleanup ⇒ Object
26 27 28 |
# File 'lib/ace/compressor/molecules/input_resolver.rb', line 26 def cleanup FileUtils.rm_rf(@temp_root) if @owns_temp_root && @temp_root && Dir.exist?(@temp_root) end |