Sha256: 3b5d50f74974ec13f25c1d23aa13c9fad8c3c8f0e6bd50c07f06a73ebe0cc892

Contents?: true

Size: 1.37 KB

Versions: 4

Compression:

Stored size: 1.37 KB

Contents

# encoding: utf-8

module Veritas
  class Function
    class Numeric

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

        # 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 Veritas

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
veritas-0.0.7 lib/veritas/function/numeric/multiplication.rb
veritas-0.0.6 lib/veritas/function/numeric/multiplication.rb
veritas-0.0.5 lib/veritas/function/numeric/multiplication.rb
veritas-0.0.4 lib/veritas/function/numeric/multiplication.rb