Module: ROM::Mapper::ModelDSL
- Defined in:
- core/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
Returns the value of attribute attributes.
-
#builder ⇒ Object
readonly
Returns the value of attribute builder.
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
Instance Method Summary collapse
-
#model(options = nil) ⇒ Object
Set or generate a model.
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
11 12 13 |
# File 'core/lib/rom/mapper/model_dsl.rb', line 11 def attributes @attributes end |
#builder ⇒ Object (readonly)
Returns the value of attribute builder.
11 12 13 |
# File 'core/lib/rom/mapper/model_dsl.rb', line 11 def builder @builder end |
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
11 12 13 |
# File 'core/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 'core/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 |