Sha256: 159b1d7fdaeaf9b7b1e008567771af92fa15931f32276562d69b16f9460fb292

Contents?: true

Size: 268 Bytes

Versions: 1

Compression:

Stored size: 268 Bytes

Contents

# frozen_string_literal: true

module Layers
  class Parser < Shrek::Layers
    def call(body = '', **options)
      next_layer.call JSON.parse(body), options
    rescue JSON::ParserError => e
      { json: e.message, status: :unprocessable_entity }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shrek-0.2.2 examples/tree_pruning/app/lib/layers/parser.rb