Sha256: 7dde6fa2d118872d0901e59c7037bc290ba7e1dc39f6598a38038b20add6de0c

Contents?: true

Size: 638 Bytes

Versions: 5

Compression:

Stored size: 638 Bytes

Contents

# frozen_string_literal: true

module ActsAsRecursiveTree
  module Options
    class QueryOptions
      STRATEGIES = %i[subselect join].freeze

      attr_accessor :condition
      attr_reader :ensure_ordering, :query_strategy

      def depth
        @depth ||= DepthCondition.new
      end

      def ensure_ordering!
        @ensure_ordering = true
      end

      def depth_present?
        @depth.present?
      end

      def query_strategy=(strategy)
        raise "invalid strategy #{strategy} - only #{STRATEGIES} are allowed" unless STRATEGIES.include?(strategy)

        @query_strategy = strategy
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
acts_as_recursive_tree-3.4.0 lib/acts_as_recursive_tree/options/query_options.rb
acts_as_recursive_tree-3.3.0 lib/acts_as_recursive_tree/options/query_options.rb
acts_as_recursive_tree-3.2.0 lib/acts_as_recursive_tree/options/query_options.rb
acts_as_recursive_tree-3.1.0 lib/acts_as_recursive_tree/options/query_options.rb
acts_as_recursive_tree-3.0.0 lib/acts_as_recursive_tree/options/query_options.rb