lib/pupa/processor.rb
def dump_scraped_object(object)
      type = object.class.to_s.demodulize.underscore
      name = "#{type}_#{object._id.gsub(File::SEPARATOR, '_')}.json"

      if @store.write_unless_exists(name, object.to_h)
        info {"save #{type} #{object.to_s} as #{name}"}
      else
        raise Errors::DuplicateObjectIdError, "duplicate object ID: #{object._id} (was the same objected yielded twice?)"
      end

      if @validate
        begin
          object.validate!
        rescue JSON::Schema::ValidationError => e
          warn {e.message}
        end
      end
    end
def dump_scraped_object(object)
      type = object.class.to_s.demodulize.underscore
      name = "#{type}_#{object._id.gsub(File::SEPARATOR, '_')}.json"

      if @store.write_unless_exists(name, object.to_h)
        info {"save #{type} #{object.to_s} as #{name}"}
      else
        raise Errors::DuplicateObjectIdError, "duplicate object ID: #{object._id} (was the same objected yielded twice?)"
      end

      if @validate
        begin
          object.validate!
        rescue JSON::Schema::ValidationError => e
          warn {e.message}
        end
      end
    end
def dump_scraped_object ( object ) type = object . class . to_s . demodulize . underscore name = "#{type}_#{object._id.gsub(File::SEPARATOR, '_')}.json" if @store . write_unless_exists ( name , object . to_h ) info { "save #{type} #{object.to_s} as #{name}" } else raise Errors :: DuplicateObjectIdError , "duplicate object ID: #{object._id} (was the same objected yielded twice?)" end if @validate begin object . validate! rescue JSON :: Schema :: ValidationError => e warn { e . message } end end end
Dumps an scraped object to disk.

 @param [Object] object an scraped object
 @raises [Pupa::Errors::DuplicateObjectIdError]
Dumps an scraped object to disk .