Sha256: 20f0afb65a8fd4d9122bcad7c57178e6363a1c934aac1fdbef27d5c9e679ff48

Contents?: true

Size: 396 Bytes

Versions: 5

Compression:

Stored size: 396 Bytes

Contents

require 'json'
module Monkeyshines
  module RawJsonContents
    def parsed_contents
      return @parsed_contents if @parsed_contents
      return nil unless contents
      begin
        @parsed_contents = JSON.load(contents.to_s)
      rescue Exception => e
        warn "JSON not parsing : #{e.to_s[0..2000].gsub(/[\r\n]+/,"")}" ; return nil
      end
      @parsed_contents
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
monkeyshines-0.2.3 lib/monkeyshines/scrape_request/raw_json_contents.rb
monkeyshines-0.2.2 lib/monkeyshines/scrape_request/raw_json_contents.rb
monkeyshines-0.2.1 lib/monkeyshines/scrape_request/raw_json_contents.rb
monkeyshines-0.2.0 lib/monkeyshines/scrape_request/raw_json_contents.rb
monkeyshines-0.0.2 lib/monkeyshines/scrape_request/raw_json_contents.rb