Sha256: ae7ff0148684099c4400e3f744e55947a25ccec5a45c02891a9cbfce2b2d09f2

Contents?: true

Size: 495 Bytes

Versions: 3

Compression:

Stored size: 495 Bytes

Contents

# frozen_string_literal: true

module TableSaw
  class InformationSchema
    %i(belongs_to constraint_names has_many).each do |method_name|
      define_method method_name do
        foreign_key_relationships.public_send method_name
      end
    end

    def primary_keys
      @primary_keys ||= TableSaw::Queries::PrimaryKeys.new.call
    end

    private

    def foreign_key_relationships
      @foreign_key_relationships ||= TableSaw::Queries::ForeignKeyRelationships.new
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
table_saw-2.2.0 lib/table_saw/information_schema.rb
table_saw-2.1.0 lib/table_saw/information_schema.rb
table_saw-2.0.0 lib/table_saw/information_schema.rb