Sha256: d105d1f04b6ed5fb498c2e7571c427189e40626f55eb3abbbcec7468dc194bdb

Contents?: true

Size: 472 Bytes

Versions: 22

Compression:

Stored size: 472 Bytes

Contents

module Capybara::Poltergeist
  module JSON
    def self.load(message)
      if dumpy_multi_json?
        MultiJson.load(message)
      else
        MultiJson.decode(message)
      end
    end

    def self.dump(message)
      if dumpy_multi_json?
        MultiJson.dump(message)
      else
        MultiJson.encode(message)
      end
    end

    private

    def self.dumpy_multi_json?
      MultiJson.respond_to?(:dump) && MultiJson.respond_to?(:load)
    end
  end
end

Version data entries

22 entries across 22 versions & 4 rubygems

Version Path
poltergeist-1.0.0 lib/capybara/poltergeist/json.rb
poltergeist-0.7.0 lib/capybara/poltergeist/json.rb