Sha256: e9cc908926f7afa30ef5a3ab64adb571a07546d56e20494dbe005f63721c0662

Contents?: true

Size: 629 Bytes

Versions: 1

Compression:

Stored size: 629 Bytes

Contents

# frozen_string_literal: true

require_relative 'relation'

module MiniKraken
  module Core
    # A specialization of a relation that accepts only goal(s)
    # as its arguments.
    class GoalRelation < Relation
      def arity
        2
      end

      protected

      def validated_args(actuals)
        actuals.each do |arg|
          unless arg.kind_of?(Goal) || arg.kind_of?(Glue::FreshEnv)
            prefix = "#{name} expects goal as argument, found a "
            raise StandardError, prefix + "'#{arg.class}': #{arg}"
          end
        end

        actuals
      end
    end # class
  end # module
end # module

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mini_kraken-0.2.04 lib/mini_kraken/core/goal_relation.rb