Class: ActiveRecord::Dbt::Column::DataTest

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ActiveRecord::Dbt::Column::DataTestable::UniqueDataTestable

#unique_test

Methods included from RequiredMethods

#define_required_methods

Methods included from ActiveRecord::Dbt::Column::DataTestable::RelationshipsDataTestable

#relationships_test

Methods included from DbtPackage::Dbterd::Column::DataTestable::RelationshipsMetaRelationshipType

#relationships_meta_relationship_type

Methods included from ActiveRecord::Dbt::Column::DataTestable::NotNullDataTestable

#not_null_test

Methods included from ActiveRecord::Dbt::Column::DataTestable::AcceptedValuesDataTestable

#accepted_values_test

Constructor Details

#initialize(table_name, column, primary_keys: [], foreign_keys: [{}]) ⇒ DataTest

Returns a new instance of DataTest.



17
18
19
20
21
22
23
# File 'lib/active_record/dbt/column/data_test.rb', line 17

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

Instance Attribute Details

#columnObject (readonly)

Returns the value of attribute column.



12
13
14
# File 'lib/active_record/dbt/column/data_test.rb', line 12

def column
  @column
end

#foreign_keysObject (readonly)

Returns the value of attribute foreign_keys.



12
13
14
# File 'lib/active_record/dbt/column/data_test.rb', line 12

def foreign_keys
  @foreign_keys
end

#primary_keysObject (readonly)

Returns the value of attribute primary_keys.



12
13
14
# File 'lib/active_record/dbt/column/data_test.rb', line 12

def primary_keys
  @primary_keys
end

#table_nameObject (readonly)

Returns the value of attribute table_name.



12
13
14
# File 'lib/active_record/dbt/column/data_test.rb', line 12

def table_name
  @table_name
end

Instance Method Details

#propertiesObject



25
26
27
28
29
# File 'lib/active_record/dbt/column/data_test.rb', line 25

def properties
  (data_tests.keys | data_tests_overrides_hash.keys).map do |key|
    data_tests_overrides_hash[key] || data_tests[key]
  end.presence
end