Sha256: 70010453ba54685760c96e208e77b2b90eb4d62a3367294af6c6cffe50531d43

Contents?: true

Size: 640 Bytes

Versions: 11

Compression:

Stored size: 640 Bytes

Contents

# frozen_string_literal: true

module TableSaw
  module DependencyGraph
    class AddDirective
      attr_reader :table_name, :partial, :has_many
      attr_accessor :ids

      def initialize(table_name, ids: [], partial: true, has_many: [])
        @table_name = table_name
        @ids = ids
        @partial = partial
        @has_many = has_many
      end

      alias partial? partial

      def selectable?
        partial? && Array(ids).size.positive?
      end

      def queryable?
        !partial || selectable?
      end

      def primary_key
        TableSaw.schema_cache.primary_keys(table_name)
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
table_saw-2.9.0 lib/table_saw/dependency_graph/add_directive.rb
table_saw-2.8.1 lib/table_saw/dependency_graph/add_directive.rb
table_saw-2.8.0 lib/table_saw/dependency_graph/add_directive.rb
table_saw-2.7.0 lib/table_saw/dependency_graph/add_directive.rb
table_saw-2.6.0 lib/table_saw/dependency_graph/add_directive.rb
table_saw-2.5.0 lib/table_saw/dependency_graph/add_directive.rb
table_saw-2.4.3 lib/table_saw/dependency_graph/add_directive.rb
table_saw-2.4.2 lib/table_saw/dependency_graph/add_directive.rb
table_saw-2.4.1 lib/table_saw/dependency_graph/add_directive.rb
table_saw-2.4.0 lib/table_saw/dependency_graph/add_directive.rb
table_saw-2.3.0 lib/table_saw/dependency_graph/add_directive.rb