Sha256: 67859d281d013f2199169870a761223bd66254cabd6a5f0b81822f80e350e616

Contents?: true

Size: 1.33 KB

Versions: 3

Compression:

Stored size: 1.33 KB

Contents

# encoding: utf-8

module Axiom
  class Function
    class Numeric

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

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

Version data entries

3 entries across 3 versions & 1 rubygems

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