Sha256: 4e1bb01fb0b9903c5f6c6fb07eee961cf6863647143425931550fe92039255bd

Contents?: true

Size: 604 Bytes

Versions: 12

Compression:

Stored size: 604 Bytes

Contents

# frozen_string_literal: true

module ROM
  module SQL
    # @api private
    class Index
      extend Initializer
      include Dry::Equalizer(:attributes, :name)

      param :attributes

      option :name, optional: true

      option :unique, default: -> { false }

      alias_method :unique?, :unique

      option :type, optional: true

      option :predicate, optional: true

      def to_a
        attributes
      end

      def partial?
        !predicate.nil?
      end

      def can_access?(attribute)
        !partial? && attributes[0].name == attribute.name
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rom-sql-3.6.4 lib/rom/sql/index.rb
rom-sql-3.6.3 lib/rom/sql/index.rb
rom-sql-3.6.2 lib/rom/sql/index.rb
rom-sql-3.6.1 lib/rom/sql/index.rb
rom-sql-3.6.0 lib/rom/sql/index.rb
rom-sql-3.5.0 lib/rom/sql/index.rb
rom-sql-3.4.0 lib/rom/sql/index.rb
rom-sql-3.3.3 lib/rom/sql/index.rb
rom-sql-3.3.2 lib/rom/sql/index.rb
rom-sql-3.3.1 lib/rom/sql/index.rb
rom-sql-3.3.0 lib/rom/sql/index.rb
rom-sql-3.2.0 lib/rom/sql/index.rb