class Squib::Args::ScaleBox
Public Class Methods
expanding_parameters()
click to toggle source
# File lib/squib/args/scale_box.rb, line 20 def self.expanding_parameters parameters.keys # all of them end
parameters()
click to toggle source
# File lib/squib/args/scale_box.rb, line 13 def self.parameters { x: 0, y: 0, width: :native, height: :native } end
params_with_units()
click to toggle source
# File lib/squib/args/scale_box.rb, line 24 def self.params_with_units parameters.keys # all of them end
Public Instance Methods
validate_height(arg, i)
click to toggle source
# File lib/squib/args/scale_box.rb, line 43 def validate_height(arg, i) return @deck.height if arg.to_s == 'deck' return :native if arg.to_s == 'native' arg = apply_shorthands(arg, @deck, axis: :y) return arg if arg.respond_to? :to_f if arg.to_s == 'scale' raise 'if height is \'scale\', width must be a number' unless width[i].respond_to? :to_f return arg end raise 'height must be a number, :scale, :native, or :deck' end
validate_width(arg, i)
click to toggle source
# File lib/squib/args/scale_box.rb, line 31 def validate_width(arg, i) return @deck.width if arg.to_s == 'deck' return :native if arg.to_s == 'native' arg = apply_shorthands(arg, @deck, axis: :x) return arg if arg.respond_to? :to_f if arg.to_s == 'scale' raise 'if width is :scale, height must be a number' unless height[i].respond_to? :to_f return arg end raise 'width must be a number, :scale, :native, or :deck' end
validate_x(arg, i)
click to toggle source
# File lib/squib/args/scale_box.rb, line 28 def validate_x(arg, i) apply_shorthands(arg, @deck, axis: :x) end
validate_y(arg,_i)
click to toggle source
# File lib/squib/args/scale_box.rb, line 29 def validate_y(arg,_i) apply_shorthands(arg, @deck, axis: :y) end