Class: Squib::Args::SaveBatch Private

Inherits:
Object
  • Object
show all
Includes:
ArgLoader, DirValidator
Defined in:
lib/squib/args/save_batch.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Class Method Summary collapse

Instance Method Summary collapse

Methods included from DirValidator

#ensure_dir_created

Methods included from ArgLoader

#[], #convert_units, #defaultify, #expand_and_set_and_defaultify, #expandable_singleton?, #load!, #prep_layout_args, #validate

Constructor Details

#initializeSaveBatch

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of SaveBatch.



11
12
# File 'lib/squib/args/save_batch.rb', line 11

def initialize
end

Class Method Details

.expanding_parametersObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



26
27
28
# File 'lib/squib/args/save_batch.rb', line 26

def self.expanding_parameters
  self.parameters.keys # all of them
end

.parametersObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/squib/args/save_batch.rb', line 14

def self.parameters
  {
    angle: 0,
    count_format: '%02d',
    dir: '_output',
    prefix: 'card_',
    rotate: false,
    trim_radius: 0,
    trim: 0,
  }
end

.params_with_unitsObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



30
31
32
# File 'lib/squib/args/save_batch.rb', line 30

def self.params_with_units
  [:trim, :trim_radius]
end

Instance Method Details

#full_filename(i) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



53
54
55
# File 'lib/squib/args/save_batch.rb', line 53

def full_filename(i)
  "#{dir[i]}/#{prefix[i]}#{count_format[i] % i}.png"
end

#summaryObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



57
58
59
# File 'lib/squib/args/save_batch.rb', line 57

def summary
  "#{dir[0]}/#{prefix[0]}_*"
end

#validate_dir(arg, _i) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



34
35
36
# File 'lib/squib/args/save_batch.rb', line 34

def validate_dir(arg, _i)
  ensure_dir_created(arg)
end

#validate_rotate(arg, i) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/squib/args/save_batch.rb', line 38

def validate_rotate(arg, i)
  case arg
  when true, :clockwise
    angle[i] = 0.5 * Math::PI
    return true
  when :counterclockwise
    angle[i] = 1.5 * Math::PI
    return true
  when false
    false
  else
    raise 'invalid option to rotate: only [true, false, :clockwise, :counterclockwise]'
  end
end