Module: BuildingBlocks
- Extended by:
- Forwardable
- Defined in:
- lib/building_blocks.rb,
lib/building_blocks/version.rb,
lib/building_blocks/builders/builder_builder.rb
Overview
Primary BuildingBlocks object providing an interface to build/define other builders using builders that build new builder objects.
Defined Under Namespace
Modules: Builders
Constant Summary collapse
- DEFAULT_DEFINITION_BUILDER =
The default builder used for defining new builders when build is invoked.
BuildingBlocks::Builders::BuilderBuilder
- VERSION =
The version of BuildingBlocks in use.
'0.0.1'
Class Method Summary collapse
-
.build(*args, &block) ⇒ Object
Builds a new object using the the default builder.
-
.default_builder ⇒ #build
Returns the object currently configured for use when defining new builders using build.
-
.default_builder=(builder) ⇒ #build
Sets the class that is used when defining new builders when using build to the provided builder.
Class Method Details
.build(*args, &block) ⇒ Object
Builds a new object using the the default builder. Any
args or block provided are delegated directly to the build
method
of the default builder.
|
# File 'lib/building_blocks.rb', line 52
|
.default_builder ⇒ #build
Returns the object currently configured for use when defining new builders using build. If a custom value has not been configured the default builder is returned.
27 28 29 |
# File 'lib/building_blocks.rb', line 27 def self.default_builder return @default_builder || DEFAULT_DEFINITION_BUILDER end |
.default_builder=(builder) ⇒ #build
Sets the class that is used when defining new builders when using build to the provided builder. If a value of nil
or false
is
provided the default builder will be
used.
42 43 44 45 46 47 |
# File 'lib/building_blocks.rb', line 42 def self.default_builder=(builder) if !!builder && !builder.respond_to?(:build) raise ArgumentError, 'Expected object that responds to #build' end @default_builder = builder end |