Sha256: d0eeed0a686e3799d8c2bd218de56522b15532c3b5dd49fa85954d608dd5450c

Contents?: true

Size: 802 Bytes

Versions: 3

Compression:

Stored size: 802 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

3 entries across 3 versions & 1 rubygems

Version Path
dry-logic-1.5.0 lib/dry/logic/operations/abstract.rb
dry-logic-1.4.0 lib/dry/logic/operations/abstract.rb
dry-logic-1.3.0 lib/dry/logic/operations/abstract.rb