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
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.
9 10 11 |
# File 'lib/rom/mapper/model_dsl.rb', line 9 def attributes @attributes end |
#builder ⇒ Object (readonly)
Returns the value of attribute builder.
9 10 11 |
# File 'lib/rom/mapper/model_dsl.rb', line 9 def builder @builder end |
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
9 10 11 |
# File 'lib/rom/mapper/model_dsl.rb', line 9 def klass @klass end |
Instance Method Details
#model(options = nil) ⇒ Object
Set or generate a model
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/rom/mapper/model_dsl.rb', line 33 def model( = nil) if .is_a?(Class) @klass = elsif type = .fetch(:type) { DEFAULT_TYPE } @builder = ModelBuilder[type].new() end build_class unless end |