Sha256: 5173eaa7a8d3b78a00768da3189484f64ff76e11391188caf249869e0f4d9016

Contents?: true

Size: 614 Bytes

Versions: 1

Compression:

Stored size: 614 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

1 entries across 1 versions & 1 rubygems

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