lib/squib/args/input_file.rb in squib-0.15.3 vs lib/squib/args/input_file.rb in squib-0.16.0.pre.preview1
- old
+ new
@@ -1,37 +1,33 @@
require_relative 'arg_loader'
-module Squib
- # @api private
- module Args
+module Squib::Args
+ module_function def extract_input_file(opts, deck, dsl_method_default = {})
+ InputFile.new(dsl_method_default).extract!(opts, deck)
+ end
- class InputFile
- include ArgLoader
+ class InputFile
+ include ArgLoader
- def initialize(dsl_method_default = {})
- @dsl_method_default = dsl_method_default
- end
+ def initialize(dsl_method_default = {})
+ @dsl_method_default = dsl_method_default
+ end
- def self.parameters
- { file: nil,
- sheet: 0,
- }
- end
+ def self.parameters
+ { file: nil }
+ end
- def self.expanding_parameters
- parameters.keys # all of them
- end
+ def self.expanding_parameters
+ parameters.keys # all of them
+ end
- def self.params_with_units
- [] # none of them
- end
-
- def validate_file(arg, _i)
- return nil if arg.nil?
- raise "File #{File.expand_path(arg)} does not exist!" unless File.exists?(arg)
- File.expand_path(arg)
- end
-
+ def self.params_with_units
+ [] # none of them
end
+ def validate_file(arg, _i)
+ return nil if arg.nil?
+ raise "File #{File.expand_path(arg)} does not exist!" unless File.exists?(arg)
+ File.expand_path(arg)
+ end
end
end