Class: Squib::Args::Transform Private

Inherits:
Object
  • Object
show all
Includes:
ArgLoader
Defined in:
lib/squib/args/transform.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 ArgLoader

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

Constructor Details

#initialize(deck = nil) ⇒ Transform

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 Transform



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

def initialize(deck = nil)
  @deck = deck
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.



28
29
30
# File 'lib/squib/args/transform.rb', line 28

def self.expanding_parameters
  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
25
26
# File 'lib/squib/args/transform.rb', line 14

def self.parameters
  { angle: 0,
    crop_x: 0,
    crop_y: 0,
    crop_width: :native,
    crop_height: :native,
    crop_corner_radius: nil,
    crop_corner_x_radius: 0,
    crop_corner_y_radius: 0,
    flip_vertical: false,
    flip_horizontal: false,
  }
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.



32
33
34
# File 'lib/squib/args/transform.rb', line 32

def self.params_with_units
  parameters.keys - [:flip_vertical, :flip_horizontal]
end

Instance Method Details

#validate_crop_corner_x_radius(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.



48
49
50
51
# File 'lib/squib/args/transform.rb', line 48

def validate_crop_corner_x_radius(arg, i)
  return crop_corner_radius[i] unless crop_corner_radius[i].nil?
  arg
end

#validate_crop_corner_y_radius(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.



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

def validate_crop_corner_y_radius(arg, i)
  return crop_corner_radius[i] unless crop_corner_radius[i].nil?
  arg
end

#validate_crop_height(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.



42
43
44
45
46
# File 'lib/squib/args/transform.rb', line 42

def validate_crop_height(arg, _i)
  return arg if @deck.nil?
  return @deck.height if arg == :deck
  arg
end

#validate_crop_width(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.



36
37
38
39
40
# File 'lib/squib/args/transform.rb', line 36

def validate_crop_width(arg, _i)
  return arg if @deck.nil?
  return @deck.width if arg == :deck
  arg
end