Class: MethodFound::Builder
- Inherits:
-
Module
- Object
- Module
- MethodFound::Builder
- Defined in:
- lib/method_found/builder.rb
Overview
Creates set of interceptors to include into a class.
Instance Attribute Summary collapse
-
#interceptors ⇒ Object
readonly
Returns the value of attribute interceptors.
Instance Method Summary collapse
-
#initialize { ... } ⇒ Builder
constructor
A new instance of Builder.
- #intercept(*args, &block) ⇒ Object
Constructor Details
#initialize { ... } ⇒ Builder
Returns a new instance of Builder.
30 31 32 33 |
# File 'lib/method_found/builder.rb', line 30 def initialize @interceptors = [] super end |
Instance Attribute Details
#interceptors ⇒ Object (readonly)
Returns the value of attribute interceptors.
26 27 28 |
# File 'lib/method_found/builder.rb', line 26 def interceptors @interceptors end |
Instance Method Details
#intercept(*args, &block) ⇒ Object
35 36 37 38 |
# File 'lib/method_found/builder.rb', line 35 def intercept(*args, &block) @interceptors.push(interceptor = Interceptor.new(*args, &block)) include interceptor end |