Module: Inflect::Responsive
- Included in:
- AbstractService
- Defined in:
- lib/inflect/responsive.rb
Overview
Allows services to respond an Inflect::Response instance.
Instance Method Summary collapse
-
#respond(content, options = {}) ⇒ Object
Supply more expressiveness and flexibility to the interface by allowing multiple ways of responding.
-
#serve(request) ⇒ Inflect::Response | nil
Method that creates Response instance.
Instance Method Details
#respond(content, options = {}) ⇒ Object
Supply more expressiveness and flexibility to the interface by allowing multiple ways of responding.
23 24 25 |
# File 'lib/inflect/responsive.rb', line 23 def respond(content, = {}) [content, ] end |
#serve(request) ⇒ Inflect::Response | nil
Method that creates Response instance.
9 10 11 12 13 |
# File 'lib/inflect/responsive.rb', line 9 def serve(request) content, = handle(request) opts = (, { query_words: request.query_words }) validate_response(Inflect::Response.new(content, opts)) end |