Module: Grape::DSL::Callbacks::ClassMethods
- Defined in:
- lib/grape/dsl/callbacks.rb
Instance Method Summary collapse
-
#after(&block) ⇒ Object
Execute the given block after the endpoint code has run.
-
#after_validation(&block) ⇒ Object
Execute the given block after validations and coercions, but before any endpoint code.
-
#before(&block) ⇒ Object
Execute the given block before validation, coercion, or any endpoint code is executed.
-
#before_validation(&block) ⇒ Object
Execute the given block after
before
, but prior to validation or coercion. -
#finally(&block) ⇒ Object
Allows you to specify a something that will always be executed after a call API call.
Instance Method Details
#after(&block) ⇒ Object
Execute the given block after the endpoint code has run.
43 44 45 |
# File 'lib/grape/dsl/callbacks.rb', line 43 def after(&block) namespace_stackable(:afters, block) end |
#after_validation(&block) ⇒ Object
Execute the given block after validations and coercions, but before any endpoint code.
38 39 40 |
# File 'lib/grape/dsl/callbacks.rb', line 38 def after_validation(&block) namespace_stackable(:after_validations, block) end |
#before(&block) ⇒ Object
Execute the given block before validation, coercion, or any endpoint code is executed.
26 27 28 |
# File 'lib/grape/dsl/callbacks.rb', line 26 def before(&block) namespace_stackable(:befores, block) end |
#before_validation(&block) ⇒ Object
Execute the given block after before
, but prior to validation or
coercion.
32 33 34 |
# File 'lib/grape/dsl/callbacks.rb', line 32 def before_validation(&block) namespace_stackable(:before_validations, block) end |
#finally(&block) ⇒ Object
Allows you to specify a something that will always be executed after a call
API call. Unlike the after
block, this code will run even on
unsuccesful requests.
This will make sure that the ApiLogger is opened and closed around every
request
63 64 65 |
# File 'lib/grape/dsl/callbacks.rb', line 63 def finally(&block) namespace_stackable(:finallies, block) end |