Class: Sparrow::Strategies::RackBodyJsonFormatStrategy

Inherits:
JsonFormatStrategy show all
Defined in:
lib/sparrow/strategies/json_format_strategies/rack_body_json_format_strategy.rb

Instance Method Summary collapse

Methods inherited from JsonFormatStrategy

convert, #initialize, register_json_format

Constructor Details

This class inherits a constructor from Sparrow::Strategies::JsonFormatStrategy

Instance Method Details

#convert(input) ⇒ String

Returns the input body.

Parameters:

  • input (#body)

    the JSON input object

Returns:

  • (String)

    the input body



17
18
19
# File 'lib/sparrow/strategies/json_format_strategies/rack_body_json_format_strategy.rb', line 17

def convert(input)
  input.body
end

#match?(input) ⇒ Boolean

Checks if the input is a RackBody

Parameters:

  • input (#body)

    the possible JSON input object

Returns:

  • (Boolean)

    True if the given input responds to #body



10
11
12
# File 'lib/sparrow/strategies/json_format_strategies/rack_body_json_format_strategy.rb', line 10

def match?(input)
  input.respond_to?(:body)
end