Class: Squib::Args::Box Private

Inherits:
Object
  • Object
show all
Includes:
ArgLoader
Defined in:
lib/squib/args/box.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, dsl_method_defaults = {}) ⇒ Box

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 Box.



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

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



22
23
24
# File 'lib/squib/args/box.rb', line 22

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.



15
16
17
18
19
20
# File 'lib/squib/args/box.rb', line 15

def self.parameters
  { x: 0, y: 0,
    width: :deck, height: :deck,
    radius: nil, x_radius: 0, y_radius: 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.



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

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

Instance Method Details

#validate_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.



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

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

#validate_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.



30
31
32
33
34
# File 'lib/squib/args/box.rb', line 30

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

#validate_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.



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

def validate_x_radius(arg, i)
  return radius[i] unless radius[i].nil?
  arg
end

#validate_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.



47
48
49
50
# File 'lib/squib/args/box.rb', line 47

def validate_y_radius(arg, i)
  return radius[i] unless radius[i].nil?
  arg
end