Module: ActiveRecord::Dbt::Configuration::Source

Includes:
Parser
Included in:
ActiveRecord::Dbt::Config
Defined in:
lib/active_record/dbt/configuration/source.rb

Defined Under Namespace

Classes: SourceNameIsNullError

Constant Summary collapse

DEFAULT_CONFIG_DIRECTORY_PATH =
'lib/dbt'
DEFAULT_EXPORT_DIRECTORY_PATH =
'doc/dbt'

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Parser

#parse_yaml

Instance Attribute Details

#config_directory_pathObject



14
15
16
# File 'lib/active_record/dbt/configuration/source.rb', line 14

def config_directory_path
  @config_directory_path ||= DEFAULT_CONFIG_DIRECTORY_PATH
end

#export_directory_pathObject



18
19
20
# File 'lib/active_record/dbt/configuration/source.rb', line 18

def export_directory_path
  @export_directory_path ||= DEFAULT_EXPORT_DIRECTORY_PATH
end

Instance Method Details

#source_configObject



26
27
28
# File 'lib/active_record/dbt/configuration/source.rb', line 26

def source_config
  @source_config ||= parse_yaml(source_config_path)
end

#source_config_pathObject



22
23
24
# File 'lib/active_record/dbt/configuration/source.rb', line 22

def source_config_path
  @source_config_path ||= "#{config_directory_path}/source_config.yml"
end

#source_nameObject



30
31
32
33
34
# File 'lib/active_record/dbt/configuration/source.rb', line 30

def source_name
  @source_name ||= source_config.dig(:sources, :name).tap do |source_name|
    raise SourceNameIsNullError, "'sources.name' is required in '#{source_config_path}'." if source_name.nil?
  end
end