Sha256: a1b4856e5700bc56737f04bc62f667ecb6bf95bde32dab4ad2033c93a7c0fda4

Contents?: true

Size: 1.36 KB

Versions: 3

Compression:

Stored size: 1.36 KB

Contents

# encoding: utf-8

module Axiom
  class Function
    class Numeric

      # A class representing a multiplication function
      class Multiplication < Numeric
        include Comparable, Binary

        # Return the Multiplication operation
        #
        # @example
        #   Multiplication.operation  # => :*
        #
        # @return [Symbol]
        #
        # @api public
        def self.operation
          :*
        end

        # Return the inverse function class
        #
        # @example
        #   Multiplication.inverse  # => Division
        #
        # @return [Class<Division>]
        #
        # @api public
        def self.inverse
          Division
        end

        module Methods
          extend Aliasable

          inheritable_alias(:* => :multiply)

          # Return a multiplication function
          #
          # @example
          #   multiplication = attribute.multiply(other)
          #
          # @param [Object] other
          #
          # @return [Multiplication]
          #
          # @api public
          def multiply(other)
            Multiplication.new(self, other)
          end

        end # module Methods

        Attribute::Numeric.class_eval { include Methods }
        Numeric.class_eval            { include Methods }

      end # class Multiplication
    end # class Numeric
  end # class Function
end # module Axiom

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
axiom-0.2.0 lib/axiom/function/numeric/multiplication.rb
axiom-0.1.1 lib/axiom/function/numeric/multiplication.rb
axiom-0.1.0 lib/axiom/function/numeric/multiplication.rb