Sha256: 427c07e7d8f71e37005bfe7669cae8b7470481448c62be51bc893bed35f9f10c

Contents?: true

Size: 625 Bytes

Versions: 8

Compression:

Stored size: 625 Bytes

Contents

module Alf
  module Algebra
    #
    # Specialization of Operator for operators that work on a unary input
    #
    module Unary

      # Class-level methods
      module ClassMethods

        # (see Operator::ClassMethods#arity)
        def arity
          1
        end

      end # module ClassMethods

      def self.included(mod)
        super
        mod.extend(ClassMethods)
      end

      # Simply returns the first operand
      def operand
        operands.first
      end

      def with_operand(operand)
        with_operands(operand)
      end

    end # module Unary
  end # module Algebra
end # module Alf

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
alf-core-0.16.3 lib/alf/algebra/support/unary.rb
alf-core-0.16.2 lib/alf/algebra/support/unary.rb
alf-core-0.16.1 lib/alf/algebra/support/unary.rb
alf-core-0.16.0 lib/alf/algebra/support/unary.rb
alf-core-0.15.0 lib/alf/algebra/support/unary.rb
alf-core-0.14.0 lib/alf-algebra/alf/algebra/support/unary.rb
alf-core-0.13.1 lib/alf-algebra/alf/algebra/support/unary.rb
alf-core-0.13.0 lib/alf-algebra/alf/algebra/support/unary.rb