Module: Vorpal::Dsl::Configuration
- Included in:
- Vorpal
- Defined in:
- lib/vorpal/dsl/configuration.rb
Instance Method Summary collapse
- #build_class_config(domain_class, options = {}, &block) ⇒ Object
- #build_config(&block) ⇒ Object
-
#define(options = {}, &block) ⇒ Engine
Configures and creates a Engine instance.
-
#map(domain_class, options = {}, &block) ⇒ Object
Maps a domain class to a relational table.
Instance Method Details
#build_class_config(domain_class, options = {}, &block) ⇒ Object
43 44 45 46 47 |
# File 'lib/vorpal/dsl/configuration.rb', line 43 def build_class_config(domain_class, ={}, &block) builder = ConfigBuilder.new(domain_class, , Driver::Postgresql.new) builder.instance_exec(&block) if block_given? builder.build end |
#build_config(&block) ⇒ Object
50 51 52 53 54 |
# File 'lib/vorpal/dsl/configuration.rb', line 50 def build_config(&block) @class_configs = [] self.instance_exec(&block) MasterConfig.new(@class_configs) end |
#define(options = {}, &block) ⇒ Engine
Configures and creates a Engine instance.
16 17 18 19 20 |
# File 'lib/vorpal/dsl/configuration.rb', line 16 def define(={}, &block) master_config = build_config(&block) db_driver = .fetch(:db_driver, Driver::Postgresql.new) Engine.new(db_driver, master_config) end |
#map(domain_class, options = {}, &block) ⇒ Object
Maps a domain class to a relational table.
38 39 40 |
# File 'lib/vorpal/dsl/configuration.rb', line 38 def map(domain_class, ={}, &block) @class_configs << build_class_config(domain_class, , &block) end |