Class: ActiveRecord::Dbt::Column::Yml

Inherits:
Object
  • Object
show all
Includes:
DataType::Mapper, I18nWrapper::Translate
Defined in:
lib/active_record/dbt/column/yml.rb

Constant Summary

Constants included from DataType::Mapper

DataType::Mapper::RUBY_TO_DWH_PLATFORM_TYPE_MAP

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from I18nWrapper::Translate

#translated_attribute_name, #translated_table_name

Methods included from RequiredMethods

#define_required_methods

Constructor Details

#initialize(table_name, column, column_data_test, primary_keys: []) ⇒ Yml

Returns a new instance of Yml.



15
16
17
18
19
20
21
# File 'lib/active_record/dbt/column/yml.rb', line 15

def initialize(table_name, column, column_data_test, primary_keys: [])
  @table_name = table_name
  @column = column
  @column_data_test = column_data_test
  @primary_keys = primary_keys
  @config = ActiveRecord::Dbt::Config.instance
end

Instance Attribute Details

#columnObject (readonly)

Returns the value of attribute column.



10
11
12
# File 'lib/active_record/dbt/column/yml.rb', line 10

def column
  @column
end

#column_data_testObject (readonly)

Returns the value of attribute column_data_test.



10
11
12
# File 'lib/active_record/dbt/column/yml.rb', line 10

def column_data_test
  @column_data_test
end

#primary_keysObject (readonly)

Returns the value of attribute primary_keys.



10
11
12
# File 'lib/active_record/dbt/column/yml.rb', line 10

def primary_keys
  @primary_keys
end

#table_nameObject (readonly)

Returns the value of attribute table_name.



10
11
12
# File 'lib/active_record/dbt/column/yml.rb', line 10

def table_name
  @table_name
end

Instance Method Details

#propertiesObject



23
24
25
26
27
28
29
30
31
# File 'lib/active_record/dbt/column/yml.rb', line 23

def properties
  {
    'name' => column_name,
    'description' => description,
    'data_type' => data_type(column.type),
    **column_overrides.except(:data_tests),
    'data_tests' => column_data_test.properties
  }.compact
end