Sha256: 4c0c6b3b6ac957222a0d610fc719774d48ef8658b2bcd9a0df0e2af5d192a79e

Contents?: true

Size: 1.25 KB

Versions: 3

Compression:

Stored size: 1.25 KB

Contents

# encoding: utf-8

module Axiom
  class Function
    class Numeric

      # A class representing a unary plus function
      class UnaryPlus < Numeric
        include Unary

        # Return the unary plus operation
        #
        # @example
        #   UnaryPlus.operation  # => :+@
        #
        # @return [Symbol]
        #
        # @api public
        def self.operation
          :+@
        end

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

        module Methods
          extend Aliasable

          inheritable_alias(:+@ => :unary_plus)

          # Return a unary plus function
          #
          # @example
          #   unary_plus = attribute.unary_plus
          #
          # @return [UnaryPlus]
          #
          # @api public
          def unary_plus
            UnaryPlus.new(self)
          end

        end # module Methods

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

      end # class UnaryPlus
    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/unary_plus.rb
axiom-0.1.1 lib/axiom/function/numeric/unary_plus.rb
axiom-0.1.0 lib/axiom/function/numeric/unary_plus.rb