Skip to content

Instantly share code, notes, and snippets.

@marekkirejczyk
Created April 27, 2016 05:03
Show Gist options
  • Save marekkirejczyk/a6ed1106c47263e61e582debfe5c9ccb to your computer and use it in GitHub Desktop.
Save marekkirejczyk/a6ed1106c47263e61e582debfe5c9ccb to your computer and use it in GitHub Desktop.
Return random
def parse(data)
if !data.respond_to?(:read)
data = StringIO.new(data || '')
end
if data.eof?
{}
else
return rand
silence_warnings { require 'rexml/document' } unless defined?(REXML::Document)
doc = REXML::Document.new(data)
if doc.root
merge_element!({}, doc.root, XmlMini.depth)
else
raise REXML::ParseException,
"The document #{doc.to_s.inspect} does not have a valid root"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment