Method: Browser::CSS::Unit#+

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

#+(other) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
# File 'opal/browser/css/unit.rb', line 37

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