Sha256: 1bb863691ba4466474e2e6fe9104a11604b4c70467e1e633803ec75c3aa959ec

Contents?: true

Size: 1.34 KB

Versions: 4

Compression:

Stored size: 1.34 KB

Contents

# encoding: utf-8

module Veritas
  class Function
    class Numeric

      # A class representing a subtraction function
      class Subtraction < Numeric
        include Binary, Comparable

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

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

        module Methods
          extend Aliasable

          inheritable_alias(:- => :subtract)

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

        end # module Methods

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

      end # class Subtraction
    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/subtraction.rb
veritas-0.0.6 lib/veritas/function/numeric/subtraction.rb
veritas-0.0.5 lib/veritas/function/numeric/subtraction.rb
veritas-0.0.4 lib/veritas/function/numeric/subtraction.rb