Sha256: 1a8b3d92c956f6ba98bf1ffa427a29d800e7b4b2bcb0ef8471eabeb39c34ad7f

Contents?: true

Size: 540 Bytes

Versions: 3

Compression:

Stored size: 540 Bytes

Contents

module Sparrow
  module Strategies
    class RackBodyJsonFormatStrategy < JsonFormatStrategy
      register_json_format

      ##
      # Checks if the input is a RackBody
      # @param [#body] input the possible JSON input object
      # @return [Boolean] True if the given input responds to #body
      def match?(input)
        input.respond_to?(:body)
      end

      ##
      # @param [#body] input the JSON input object
      # @return [String] the input body
      def convert(input)
        input.body
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cp-sparrow-0.0.16 lib/sparrow/strategies/json_format_strategies/rack_body_json_format_strategy.rb
cp-sparrow-0.0.15 lib/sparrow/strategies/json_format_strategies/rack_body_json_format_strategy.rb
cp-sparrow-0.0.14 lib/sparrow/strategies/json_format_strategies/rack_body_json_format_strategy.rb