Sha256: 0cf611caf5b750b07c738373ab249addb2c1dff8b005528558a1209b77e1022c

Contents?: true

Size: 674 Bytes

Versions: 1

Compression:

Stored size: 674 Bytes

Contents

# frozen_string_literal: true

module Danica
  module BaseOperations
    def +(other)
      formatted_operation other, addition(self, other)
    end

    def *(other)
      formatted_operation other, multiplication(self, other)
    end

    def /(other)
      formatted_operation other, division(self, other)
    end

    def -(other)
      formatted_operation other, (self + negative(other))
    end

    def **(other)
      formatted_operation other, power(self, other)
    end

    def -@
      negative(self)
    end

    private

    def formatted_operation(other, value)
      return other.repack(value) if other.is_a?(Danica::Formatted)
      value
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
danica-2.7.5 lib/danica/base_operations.rb