Module: JSON
- Defined in:
- lib/right_agent/packets.rb
Overview
Hack to replace the Nanite namespace from downrev agents with the RightScale namespace
Class Method Summary collapse
Class Method Details
.parse(source, opts = {}) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/right_agent/packets.rb', line 26 def parse(source, opts = {}) # In gem version this options is set to true by default # but in ruby native json library is set to false by default # Explicitly set it to true so both json libraries act the same opts[:create_additions] = true if source =~ /(.*)json_class":"Nanite::(.*)/ JSON.parser.new( Regexp.last_match(1) + 'json_class":"RightScale::' + Regexp.last_match(2), opts).parse else JSON.parser.new(source, opts).parse end end |