Class: BuildingBlocks::Builders::BuilderBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/building_blocks/builders/builder_builder.rb

Overview

A builder that builds other builders using a minimal definition DSL. In brief, classes generated by this builder offer a number of built-in DSL macros that are used to describe how methods called against instances of the generated builder class are translated into actions to be taken on the object instance being built by the generated builder instance.

Defined Under Namespace

Modules: ClassInstanceMethods, InstanceMethods

Class Method Summary collapse

Class Method Details

.buildClass

Generates a new builder class with a number of built-in DSL methods used to describe how actions taken against instances of the builder class are translated into actions to be taken on the object instance being built. Further information on the available DSL methods can be found in ClassInstanceMethods.



19
20
21
22
23
24
25
# File 'lib/building_blocks/builders/builder_builder.rb', line 19

def self.build
  klass = Class.new
  klass.extend(ClassInstanceMethods)
  klass.send(:include, InstanceMethods)
  klass.module_eval(&Proc.new) if block_given?
  klass
end