Sha256: b20f3f2c438af2d6a9be9ed2fa4702b0dc5d9193628ffe094fa97bdc6a3ea1a3

Contents?: true

Size: 592 Bytes

Versions: 2

Compression:

Stored size: 592 Bytes

Contents

# frozen_string_literal: true

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

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

      alias partial? partial

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

      def queryable?
        !partial || selectable?
      end

      def primary_key
        TableSaw.information_schema.primary_keys[table_name]
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
table_saw-1.0.1 lib/table_saw/dependency_graph/add_directive.rb
table_saw-1.0.0 lib/table_saw/dependency_graph/add_directive.rb