module AppleReceipt::NextStepParser

NextStepParser parses NextSTEP Plist data structures.

Public Instance Methods

parse(input) click to toggle source
# File lib/apple_receipt/next_step_parser.rb, line 10
def parse(input)
  # Transform JSON-like NextSTEP PList data into JSON
  raw_json = input.gsub(/;\n\t/, ",\n\t")
                  .gsub(/\ =/, ':')
                  .gsub(/;\n/, '')
  h = JSON.parse(raw_json)
  h.transform_keys { |k| k.tr('-', '_') }
end