Class: ActiveRecord::Dbt::Column::Yml
- Inherits:
-
Object
- Object
- ActiveRecord::Dbt::Column::Yml
- Defined in:
- lib/active_record/dbt/column/yml.rb
Constant Summary collapse
- SQL_KEYWORDS =
MEMO: GitHub copilot taught me this.
%w[ ADD ALL ALTER AND ANY AS ASC BACKUP BETWEEN CASE CHECK COLUMN CONSTRAINT CREATE DATABASE DEFAULT DELETE DESC DISTINCT DROP EXEC EXISTS FOREIGN FROM FULL GROUP HAVING IN INDEX INNER INSERT INTO IS JOIN LEFT LIKE LIMIT NOT NULL OR ORDER OUTER PRIMARY PROCEDURE RIGHT ROWNUM SELECT SET TABLE TOP TRUNCATE UNION UNIQUE UPDATE VALUES VIEW WHERE ].freeze
Constants included from DataType::Mapper
DataType::Mapper::RUBY_TO_DWH_PLATFORM_TYPE_MAP
Instance Attribute Summary collapse
-
#column ⇒ Object
readonly
Returns the value of attribute column.
-
#column_data_test ⇒ Object
readonly
Returns the value of attribute column_data_test.
-
#primary_keys ⇒ Object
readonly
Returns the value of attribute primary_keys.
-
#table_name ⇒ Object
readonly
Returns the value of attribute table_name.
Instance Method Summary collapse
- #column_description ⇒ Object
-
#initialize(table_name, column, column_data_test = Struct.new(:properties).new, primary_keys: []) ⇒ Yml
constructor
A new instance of Yml.
- #properties ⇒ Object
Methods included from Validation::TableNameValidator
Methods included from I18nWrapper::Translate
#translated_column_name, #translated_table_name
Methods included from RequiredMethods
Constructor Details
#initialize(table_name, column, column_data_test = Struct.new(:properties).new, primary_keys: []) ⇒ Yml
Returns a new instance of Yml.
27 28 29 30 31 32 33 |
# File 'lib/active_record/dbt/column/yml.rb', line 27 def initialize(table_name, column, column_data_test = Struct.new(:properties).new, primary_keys: []) @config = ActiveRecord::Dbt::Config.instance @table_name = validate_table_name(table_name, @config) @column = column @column_data_test = column_data_test @primary_keys = primary_keys end |
Instance Attribute Details
#column ⇒ Object (readonly)
Returns the value of attribute column.
13 14 15 |
# File 'lib/active_record/dbt/column/yml.rb', line 13 def column @column end |
#column_data_test ⇒ Object (readonly)
Returns the value of attribute column_data_test.
13 14 15 |
# File 'lib/active_record/dbt/column/yml.rb', line 13 def column_data_test @column_data_test end |
#primary_keys ⇒ Object (readonly)
Returns the value of attribute primary_keys.
13 14 15 |
# File 'lib/active_record/dbt/column/yml.rb', line 13 def primary_keys @primary_keys end |
#table_name ⇒ Object (readonly)
Returns the value of attribute table_name.
13 14 15 |
# File 'lib/active_record/dbt/column/yml.rb', line 13 def table_name @table_name end |
Instance Method Details
#column_description ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/active_record/dbt/column/yml.rb', line 46 def column_description config_column_description || translated_column_name || column_comment || key_column_name || default_column_description end |
#properties ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/active_record/dbt/column/yml.rb', line 35 def properties { 'name' => column_name, 'description' => description, 'quote' => quote?, 'data_type' => data_type(column.type), **column_overrides.except(:data_tests), 'data_tests' => column_data_test.properties }.compact end |