Sha256: ec740e431263575e95f9b32a4a1d97e9bf3c2b94ded3dba35ec8cc59223154b3

Contents?: true

Size: 387 Bytes

Versions: 28

Compression:

Stored size: 387 Bytes

Contents

# frozen_string_literal: true

module TableSync::NamingResolver
  class ActiveRecord
    def initialize(table_name:)
      @table_name = table_name
    end

    def table
      meta_data.last
    end

    def schema
      meta_data.size > 1 ? meta_data[-2] : "public"
    end

    private

    attr_reader :table_name

    def meta_data
      table_name.to_s.split "."
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
table_sync-6.5.1 lib/table_sync/naming_resolver/active_record.rb
table_sync-6.5.0 lib/table_sync/naming_resolver/active_record.rb
table_sync-6.4.2 lib/table_sync/naming_resolver/active_record.rb
table_sync-6.4.1 lib/table_sync/naming_resolver/active_record.rb
table_sync-6.4.0 lib/table_sync/naming_resolver/active_record.rb
table_sync-6.3.0 lib/table_sync/naming_resolver/active_record.rb
table_sync-6.1.0 lib/table_sync/naming_resolver/active_record.rb
table_sync-6.0.4 lib/table_sync/naming_resolver/active_record.rb
table_sync-6.0.3 lib/table_sync/naming_resolver/active_record.rb
table_sync-6.0.2 lib/table_sync/naming_resolver/active_record.rb
table_sync-6.0 lib/table_sync/naming_resolver/active_record.rb
table_sync-5.1.0 lib/table_sync/naming_resolver/active_record.rb
table_sync-5.0.0 lib/table_sync/naming_resolver/active_record.rb
table_sync-4.2.2 lib/table_sync/naming_resolver/active_record.rb
table_sync-4.2.1 lib/table_sync/naming_resolver/active_record.rb
table_sync-4.2.0 lib/table_sync/naming_resolver/active_record.rb
table_sync-4.1.3 lib/table_sync/naming_resolver/active_record.rb
table_sync-4.1.1 lib/table_sync/naming_resolver/active_record.rb
table_sync-4.1.0 lib/table_sync/naming_resolver/active_record.rb
table_sync-4.0.0 lib/table_sync/naming_resolver/active_record.rb