Method: Dbee::Model#initialize
- Defined in:
- lib/dbee/model.rb
#initialize(name:, constraints: [], relationships: [], models: [], partitioners: [], table: '') ⇒ Model
Returns a new instance of Model.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/dbee/model.rb', line 32 def initialize( name:, constraints: [], # Exists here for tree based model backward compatibility. relationships: [], models: [], # Exists here for tree based model backward compatibility. partitioners: [], table: '' ) @name = name @constraints = Constraints.array(constraints || []).uniq @relationships = Relationships.make_keyed_by(:name, relationships) @models_by_name = name_hash(Model.array(models)) @partitioners = Partitioner.array(partitioners).uniq @table = table.to_s.empty? ? @name : table.to_s ensure_input_is_valid freeze end |