Module: Cliqr::Config::DSL Private
- Included in:
- Base
- Defined in:
- lib/cliqr/config/dsl.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Used to separate all dsl methods in a separate block, thus allowing separation of concerns between non-dsl methods with dsl methods which improves maintainability.
Defined Under Namespace
Classes: DSLDelegator
Class Method Summary collapse
-
.included(base) ⇒ Object
private
If a class includes this module, we add a few useful methods to that class.
Class Method Details
.included(base) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
If a class includes this module, we add a few useful methods to that class
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/cliqr/config/dsl.rb', line 18 def self.included(base) base.class_eval do def self.inherited(base) transfer_validations(base) DSL.included(base) end def self.transfer_validations(base) base.validations.merge(validations) end # Entry point for invoking dsl methods # # @param [Hash] args Arguments to be used to build the DSL instance # # @param [Function] block The block to evaluate the DSL # # @return [Cliqr::DSL] def self.build(*args, &block) base = new(*args) if block_given? delegator = DSLDelegator.new(base) delegator.instance_eval(&block) end base.finalize base end end end |