Module: ROM::Mapper::ModelDSL
- Included in:
- AttributeDSL
- Defined in:
- lib/rom/mapper/model_dsl.rb
Overview
Model DSL allows setting a model class
Constant Summary collapse
- DEFAULT_TYPE =
:poro
Instance Attribute Summary collapse
- #attributes ⇒ Object readonly
- #builder ⇒ Object readonly
- #klass ⇒ Object readonly
Instance Method Summary collapse
-
#model(options = nil) ⇒ Object
Set or generate a model.
Instance Attribute Details
#attributes ⇒ Object (readonly)
11 12 13 |
# File 'lib/rom/mapper/model_dsl.rb', line 11 def attributes @attributes end |
#builder ⇒ Object (readonly)
11 12 13 |
# File 'lib/rom/mapper/model_dsl.rb', line 11 def builder @builder end |
#klass ⇒ Object (readonly)
11 12 13 |
# File 'lib/rom/mapper/model_dsl.rb', line 11 def klass @klass end |
Instance Method Details
#model(options = nil) ⇒ Object
Set or generate a model
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/rom/mapper/model_dsl.rb', line 35 def model( = nil) if .is_a?(Class) @klass = elsif type = .fetch(:type) { DEFAULT_TYPE } @builder = ModelBuilder[type].new() end build_class unless end |