Class: GlassOctopus::Middleware::JsonParser
- Inherits:
-
Object
- Object
- GlassOctopus::Middleware::JsonParser
- Defined in:
- lib/glass_octopus/middleware/json_parser.rb
Defined Under Namespace
Classes: ContextWithJsonParsedMessage
Instance Method Summary collapse
- #call(ctx) ⇒ Object
-
#initialize(app, options = {}) ⇒ JsonParser
constructor
A new instance of JsonParser.
Constructor Details
#initialize(app, options = {}) ⇒ JsonParser
Returns a new instance of JsonParser.
7 8 9 10 11 12 |
# File 'lib/glass_octopus/middleware/json_parser.rb', line 7 def initialize(app, ={}) @app = app @klass = .delete(:class) @encoding = .delete(:encoding) @options = end |
Instance Method Details
#call(ctx) ⇒ Object
14 15 16 17 18 |
# File 'lib/glass_octopus/middleware/json_parser.rb', line 14 def call(ctx) = parse(ensure_encoding(ctx..value)) ctx = ContextWithJsonParsedMessage.new(ctx, ) @app.call(ctx) end |