Sha256: 449a48a34d90c37c3bf489385e422e915db9d43db6bb25e5d52e525a25e6840b
Contents?: true
Size: 642 Bytes
Versions: 18
Compression:
Stored size: 642 Bytes
Contents
# -*- encoding: utf-8 -*- require 'webgen/error' # Require the given library but handle a possible loading error more gracefully. # # The parameter +gem+ (which defaults to +library+) should be set to the Rubygem that provides the # library or to +nil+ if no such Rubygem exists. def webgen_require(library, gem = library) require library rescue LoadError raise Webgen::LoadError.new(library, self.class.name, nil, gem) end class Hash # Return a new hash where all String keys are converted to Symbol keys. def symbolize_keys hash = dup hash.keys.each {|k| hash[(k.to_sym rescue k)] = hash.delete(k)} hash end end
Version data entries
18 entries across 18 versions & 1 rubygems