Module: Hanami::Middleware::BodyParser::ClassInterface Private

Included in:
Hanami::Middleware::BodyParser
Defined in:
lib/hanami/middleware/body_parser/class_interface.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Since:

  • 1.3.0

Instance Method Summary collapse

Instance Method Details

#for(parser) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 1.3.0



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/hanami/middleware/body_parser/class_interface.rb', line 13

def for(parser)
  parser =
    case parser
    when String, Symbol
      require_parser(parser)
    when Class
      parser.new
    else
      parser
    end

  ensure_parser parser

  parser
end