Class: Squib::Args::InputFile
- Inherits:
-
Object
- Object
- Squib::Args::InputFile
show all
- Includes:
- ArgLoader
- Defined in:
- lib/squib/args/input_file.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from ArgLoader
#[], #convert_units, #deck_conf, #defaultify, #expand_and_set_and_defaultify, #expandable_singleton?, #extract!, #load!, #prep_layout_args, #validate
Constructor Details
#initialize(dsl_method_default = {}) ⇒ InputFile
Returns a new instance of InputFile.
11
12
13
|
# File 'lib/squib/args/input_file.rb', line 11
def initialize(dsl_method_default = {})
@dsl_method_default = dsl_method_default
end
|
Class Method Details
.expanding_parameters ⇒ Object
22
23
24
|
# File 'lib/squib/args/input_file.rb', line 22
def self.expanding_parameters
parameters.keys end
|
.parameters ⇒ Object
15
16
17
18
19
20
|
# File 'lib/squib/args/input_file.rb', line 15
def self.parameters
{
file: nil,
placeholder: nil
}
end
|
.params_with_units ⇒ Object
26
27
28
|
# File 'lib/squib/args/input_file.rb', line 26
def self.params_with_units
[] end
|
Instance Method Details
#validate_file(arg, i) ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/squib/args/input_file.rb', line 30
def validate_file(arg, i)
return nil if arg.nil?
return File.expand_path(arg) if File.exist?(arg)
return File.expand_path(placeholder[i]) if File.exist?(placeholder[i].to_s)
case deck_conf.img_missing.to_sym
when :error
raise "File #{File.expand_path(arg)} does not exist!"
when :warn
Squib.logger.warn "File #{File.expand_path(arg)} does not exist!"
end
return nil end
|
#validate_placeholder(arg, _i) ⇒ Object
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/squib/args/input_file.rb', line 44
def validate_placeholder(arg, _i)
unless arg.nil? || File.exist?(arg)
msg = "Image placeholder #{File.expand_path(arg)} does not exist!"
Squib.logger.warn msg
return nil
end
return arg
end
|