Sha256: d84c3f7e9f06aff153c3f2d8f9d9fdf5eb631df33806c29ef412e6ab993cc44c

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

# encoding: utf-8

module Axiom
  class Function
    class Numeric

      # A class representing a modulo function
      class Modulo < Numeric
        include Comparable, Binary

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

        module Methods
          extend Aliasable

          inheritable_alias(
            :%   => :modulo,
            :mod => :modulo
          )

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

        end # module Methods

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

      end # class Modulo
    end # class Numeric
  end # class Function
end # module Axiom

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
axiom-0.1.0 lib/axiom/function/numeric/modulo.rb