Module: Uber::Builder
- Defined in:
- lib/uber/builder.rb
Overview
When included, allows to add builder on the class level.
class Operation
include Uber::Builder
builds do |params|
SignedIn if params[:current_user]
end
class SignedIn
end
The class then has to call the builder to compute a class name using the build blocks you defined.
def self.build(params)
class_builder.call(params).
new(params)
end
Defined Under Namespace
Modules: ClassMethods Classes: Constant
Class Method Summary collapse
Class Method Details
.included(base) ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/uber/builder.rb', line 21 def self.included(base) base.class_eval do def self.builders @builders ||= [] end extend ClassMethods end end |