Sha256: 8cde93c93cf92972929ce1ffaa4fd672edee51a2d1eef5dc5f7defd841108add

Contents?: true

Size: 804 Bytes

Versions: 1

Compression:

Stored size: 804 Bytes

Contents

# frozen_string_literal: true

module Dry
  module Logic
    module Operations
      class Abstract
        include Core::Constants
        include ::Dry::Equalizer(:rules, :options)
        include Operators

        attr_reader :rules

        attr_reader :options

        def initialize(*rules, **options)
          @rules = rules
          @options = options
        end

        def id
          options[:id]
        end

        def curry(*args)
          new(rules.map { |rule| rule.curry(*args) }, **options)
        end

        def new(rules, **new_options)
          self.class.new(*rules, **options, **new_options)
        end

        def with(new_options)
          new(rules, **options, **new_options)
        end

        def to_ast
          ast
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dry-logic-1.6.0 lib/dry/logic/operations/abstract.rb