Class: Bankrupt::Util

Inherits:
Object
  • Object
show all
Defined in:
lib/bankrupt/util.rb

Overview

Utilities for working with asset manifest files.

Class Method Summary collapse

Class Method Details

.parse_manifest(path) ⇒ Hash

Parse the asset manifest

Parameters:

  • path (String)

    path to the manifest

Returns:

  • (Hash)

    parsed manifest or empty hash on error



24
25
26
27
28
29
30
# File 'lib/bankrupt/util.rb', line 24

def self.parse_manifest(path)
  JSON.parse(File.read(path)).map do |k, v|
    [k.freeze, v.map { |l, b| [l.to_sym, b.freeze] }.to_h.freeze]
  end.to_h.freeze
rescue StandardError
  {}
end