Class: Squib::Args::Paint Private

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

#colorify

Methods included from ArgLoader

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

Constructor Details

#initialize(custom_colors) ⇒ Paint

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



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

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



20
21
22
# File 'lib/squib/args/paint.rb', line 20

def self.expanding_parameters
  parameters.keys # all of them are expandable
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.



12
13
14
15
16
17
# File 'lib/squib/args/paint.rb', line 12

def self.parameters
  { alpha: 1.0,
    blend: :none,
    mask:  nil,
  }
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.



24
25
26
# File 'lib/squib/args/paint.rb', line 24

def self.params_with_units
  []
end

Instance Method Details

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



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

def validate_alpha(arg, _i)
  raise 'alpha must respond to to_f' unless arg.respond_to? :to_f
  arg.to_f
end

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



37
38
39
# File 'lib/squib/args/paint.rb', line 37

def validate_mask(arg, _i)
  colorify(arg, @custom_colors)
end