Sha256: d49fb5155e2debc44c82b7a12cf9eab3d615773f5cc9407e2db0fff9622dc88f

Contents?: true

Size: 615 Bytes

Versions: 2

Compression:

Stored size: 615 Bytes

Contents

module Sparrow
  module Strategies
    ##
    # NullObject JSON Format Strategy
    # Does no direct conversion except casting the given object to a string
    class DefaultJsonFormatStrategy
      include Singleton

      ##
      # Matches always since this is the NullObjectStrategy and thus the
      # fallback.
      # @param [Object] input the JSON input
      # @return [Boolean] True
      def match?(_input)
        true
      end

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

Version data entries

2 entries across 2 versions & 1 rubygems

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