Module: Journeyman::Definition
- Included in:
- Journeyman
- Defined in:
- lib/journeyman/definition.rb
Overview
Internal: Contains all the factory method definition logic.
Instance Method Summary collapse
-
#define(name, options = {}, &config) ⇒ Object
Public: Defines a new factory for Journeyman, which consists in a build and create method, and may optionally include finder and default methods.
Instance Method Details
#define(name, options = {}, &config) ⇒ Object
Public: Defines a new factory for Journeyman, which consists in a build and create method, and may optionally include finder and default methods.
Returns Builder for debug purposes.
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/journeyman/definition.rb', line 11 def define(name, ={}, &config) finder, default = .delete(:include_finder), .delete(:include_default) Builder.new(name, , config).tap do |builder| define_find_method(name, builder) unless finder == false define_build_method(name, builder) define_create_method(name, builder) define_default_method(name) if default end end |