Sha256: 5cc64faa320b7615b961ba1630982ac3328476ef92cf6f3272004b62184bfe13

Contents?: true

Size: 964 Bytes

Versions: 7

Compression:

Stored size: 964 Bytes

Contents

# frozen_string_literal: true

module MiniKraken
  module Core
    class Relation
      # @return [String] Name of the relation.
      attr_reader :name

      # @return [String, NilClass] Optional alternative name of the relation.
      attr_reader :alt_name

      # @param aName [String] Name of the relation.
      # @param alternateName [String, NilClass] Alternative name (optional).
      def initialize(aName, alternateName = nil)
        @name = aName
        @alt_name = alternateName
      end

      # A relation is polyadic when it accepts an arbitrary number of arguments.
      # Most built-in relation takes a fixed number of arguments (= arity).
      # @return [Boolean]
      def polyadic?
        false
      end

      # Number of arguments for the relation.
      # @return [Integer]
      def arity
        raise NotImplementedError
      end

      def inspect
        alt_name || name
      end
    end # class
  end # module
end # module

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
mini_kraken-0.2.04 lib/mini_kraken/core/relation.rb
mini_kraken-0.2.03 lib/mini_kraken/core/relation.rb
mini_kraken-0.2.02 lib/mini_kraken/core/relation.rb
mini_kraken-0.2.01 lib/mini_kraken/core/relation.rb
mini_kraken-0.2.00 lib/mini_kraken/core/relation.rb
mini_kraken-0.1.13 lib/mini_kraken/core/relation.rb
mini_kraken-0.1.12 lib/mini_kraken/core/relation.rb