Sha256: 91134f8536d43302127dbb4371b63c78093c0d65d612810bced0e2ae5579ad6c

Contents?: true

Size: 689 Bytes

Versions: 2

Compression:

Stored size: 689 Bytes

Contents

# frozen_string_literal: true

module ActiveRecord
  module Dbt
    module Source
      class Yml
        attr_reader :tables

        delegate :source_config, to: :@config

        def initialize(tables)
          @tables = tables
          @config = ActiveRecord::Dbt::Config.instance
        end

        def config
          {
            'version' => 2,
            'sources' => [
              source_properties.merge('tables' => tables_properties)
            ]
          }
        end

        private

        def source_properties
          source_config[:sources]
        end

        def tables_properties
          tables.map(&:config)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
activerecord-dbt-0.2.0 lib/active_record/dbt/source/yml.rb
activerecord-dbt-0.1.0 lib/active_record/dbt/source/yml.rb