Sha256: 081baecbdc35fa0473f68227042ea4c4980b401e7bdb7acaa2d10118d3e699a8
Contents?: true
Size: 1.3 KB
Versions: 2
Compression:
Stored size: 1.3 KB
Contents
require 'squib/args/arg_loader' module Squib # @api private module Args class ScaleBox include ArgLoader def initialize(deck) @deck = deck end def self.parameters { x: 0, y: 0, width: :native, height: :native } end def self.expanding_parameters parameters.keys # all of them end def self.params_with_units parameters.keys # all of them end def validate_width(arg, i) return @deck.width if arg.to_s == 'deck' return :native if arg.to_s == 'native' 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 def validate_height(arg, i) return @deck.height if arg.to_s == 'deck' return :native if arg.to_s == 'native' 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 end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
squib-0.8.0 | lib/squib/args/scale_box.rb |
squib-0.7.0 | lib/squib/args/scale_box.rb |