Method: Browser::CSS::Unit#-

Defined in:
opal/browser/css/unit.rb

#-(other) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
# File 'opal/browser/css/unit.rb', line 49

def -(other)
  return Unit.new(@number - other, @type) unless Unit === other

  if @type == other.type
    Unit.new(@number - other.to_f, @type)
  elsif compatible?(self) and compatible?(other)
    Unit.new(@number - convert(other, @type), @type)
  else
    raise ArgumentError, "#{other.type} isn't compatible with #{@type}"
  end
end