Method: Squib::Args::ScaleBox#validate_height

Defined in:
lib/squib/args/scale_box.rb

#validate_height(arg, i) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
# 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