Class: AttributeExtras::ExtraBuilder
- Inherits:
-
Object
- Object
- AttributeExtras::ExtraBuilder
- Defined in:
- lib/attribute_extras/extra_builder.rb
Overview
Builds a concern that will be included into classes when they call the macro corresponding to the given verb. For instance, for the verb :nullify it will build out AttributeExtras::NullifyAttributes, which can be included into classes to get all of the utility functions.
Instance Method Summary collapse
-
#build ⇒ Object
build the extra.
-
#initialize(verb, past, function, validator, options) ⇒ ExtraBuilder
constructor
store the given options.
Constructor Details
#initialize(verb, past, function, validator, options) ⇒ ExtraBuilder
store the given options
10 11 12 13 14 15 16 |
# File 'lib/attribute_extras/extra_builder.rb', line 10 def initialize(verb, past, function, validator, ) @verb = verb @past = past @function = function @validator = validator = end |
Instance Method Details
#build ⇒ Object
build the extra
19 20 21 22 23 24 |
# File 'lib/attribute_extras/extra_builder.rb', line 19 def build concern = Module.new concern.module_eval(concern_definition) concern::ClassMethods.module_eval(&utilities_definition) concern end |