Class: Grape::Knock::Authenticable
- Inherits:
-
Middleware::Base
- Object
- Middleware::Base
- Grape::Knock::Authenticable
- Includes:
- Knock::Authenticable
- Defined in:
- lib/grape/knock/authenticable.rb
Instance Method Summary collapse
- #before ⇒ Object
- #context ⇒ Object
-
#initialize(_, options = {}) ⇒ Authenticable
constructor
A new instance of Authenticable.
Constructor Details
#initialize(_, options = {}) ⇒ Authenticable
Returns a new instance of Authenticable.
10 11 12 13 |
# File 'lib/grape/knock/authenticable.rb', line 10 def initialize(_, = {}) super define_current_entity_getter entity_class, getter_name end |
Instance Method Details
#before ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/grape/knock/authenticable.rb', line 19 def before authenticate memoization_var_name = "@_#{getter_name}" context.send(:instance_variable_set, memoization_var_name, send(getter_name)) context.class.send(:define_method, getter_name) { instance_variable_get memoization_var_name } end |
#context ⇒ Object
15 16 17 |
# File 'lib/grape/knock/authenticable.rb', line 15 def context env['api.endpoint'] end |