Class: Sparrow::Strategies::DefaultJsonFormatStrategy

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/sparrow/strategies/json_format_strategies/default_json_format_strategy.rb

Overview

NullObject JSON Format Strategy Does no direct conversion except casting the given object to a string

Instance Method Summary collapse

Instance Method Details

#convert(input) ⇒ String

Returns the input as a String.

Parameters:

  • input (#to_s)

    the JSON object

Returns:

  • (String)

    the input as a String



21
22
23
# File 'lib/sparrow/strategies/json_format_strategies/default_json_format_strategy.rb', line 21

def convert(input)
  input.to_s
end

#match?(_input) ⇒ Boolean

Matches always since this is the NullObjectStrategy and thus the fallback.

Parameters:

  • input (Object)

    the JSON input

Returns:

  • (Boolean)

    True



14
15
16
# File 'lib/sparrow/strategies/json_format_strategies/default_json_format_strategy.rb', line 14

def match?(_input)
  true
end