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

Version Path
webgen-1.7.3 lib/webgen/core_ext.rb
webgen-1.7.2 lib/webgen/core_ext.rb
webgen-1.7.1 lib/webgen/core_ext.rb
webgen-1.7.0 lib/webgen/core_ext.rb
webgen-1.6.0 lib/webgen/core_ext.rb
webgen-1.5.2 lib/webgen/core_ext.rb
webgen-1.5.1 lib/webgen/core_ext.rb
webgen-1.5.0 lib/webgen/core_ext.rb
webgen-1.4.1 lib/webgen/core_ext.rb
webgen-1.4.0 lib/webgen/core_ext.rb
webgen-1.3.0 lib/webgen/core_ext.rb
webgen-1.2.1 lib/webgen/core_ext.rb
webgen-1.2.0 lib/webgen/core_ext.rb
webgen-1.1.0 lib/webgen/core_ext.rb
webgen-1.0.0 lib/webgen/core_ext.rb
webgen-1.0.0.beta3 lib/webgen/core_ext.rb
webgen-1.0.0.beta2 lib/webgen/core_ext.rb
webgen-1.0.0.beta1 lib/webgen/core_ext.rb