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

Instance Method Details

#respond(content, options = {}) ⇒ Inflect::Response?

Method that creates Response instance.

Parameters:

  • content (String, Hash)

    the response of the service.

Returns:


10
11
12
13
# File 'lib/inflect/responsive.rb', line 10

def respond(content, options = {})
  opts = merge_options(options)
  validate_response(Inflect::Response.new(content, opts))
end

#respond!(content, options = {}) ⇒ Inflect::Response

Method that creates Response instance, skipping response validation.

Parameters:

  • content (String, Hash)

    the response of the service.

Returns:


18
19
20
21
# File 'lib/inflect/responsive.rb', line 18

def respond!(content, options = {})
  opts = merge_options(options)
  Inflect::Response.new(content, opts)
end