Sha256: 8fff6241a76c4fc8546850ba369799e5ee6816d14f5cf72880ce2a6fc9e5a4a3

Contents?: true

Size: 667 Bytes

Versions: 2

Compression:

Stored size: 667 Bytes

Contents

require "ios/contents/json/version"
require 'json'

module Ios
  module Contents
    module Json
      class << self
        def load(file)
          data = File.open(file).read
          JSON.parse(data)
        end

        def save(file, json)
          data = JSON.pretty_generate(json)
          File.open(file, "w").write(data)
        end

        def convert(json)
          image = json["images"][0]
          image.delete("scale")
          json["images"] = [image]
          json
        end

        def run(file)
          json = self.load(file)
          json = self.convert(json)
          self.save(file, json)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ios-contents-json-0.0.2 lib/ios/contents/json.rb
ios-contents-json-0.0.1 lib/ios/contents/json.rb