Sha256: 92ce7cc2cb09341834effbcc16983f8510b52a9b843cfdde25dc462468b1af76

Contents?: true

Size: 278 Bytes

Versions: 42

Compression:

Stored size: 278 Bytes

Contents

require 'yaml'

class Hash

  def self.hash_from_yaml(yaml_file)
    YAML::load_file(yaml_file).symbolize! 
  end
  
  def symbolize!
    keys.each do |k|
      self[k.to_sym] = delete(k)
      self[k.to_sym].symbolize! if self[k.to_sym].is_a? Hash
    end
    self
  end 
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
fwtoolkit-2.6.4 lib/fwtoolkit/ext/hash_yaml.rb
fwtoolkit-2.6.3 lib/fwtoolkit/ext/hash_yaml.rb
fwtoolkit-2.6.2 lib/fwtoolkit/ext/hash_yaml.rb
fwtoolkit-2.6.1 lib/fwtoolkit/ext/hash_yaml.rb
fwtoolkit-2.6.0 lib/fwtoolkit/ext/hash_yaml.rb
fwtoolkit-2.5.0 lib/fwtoolkit/ext/hash_yaml.rb
fwtoolkit-2.4.0 lib/fwtoolkit/ext/hash_yaml.rb
fwtoolkit-2.3.6 lib/fwtoolkit/ext/hash_yaml.rb
fwtoolkit-2.3.5 lib/fwtoolkit/ext/hash_yaml.rb
fwtoolkit-2.3.4 lib/fwtoolkit/ext/hash_yaml.rb
fwtoolkit-2.3.3 lib/fwtoolkit/ext/hash_yaml.rb
fwtoolkit-2.3.2 lib/fwtoolkit/ext/hash_yaml.rb
fwtoolkit-2.3.1 lib/fwtoolkit/ext/hash_yaml.rb
fwtoolkit-2.3.0 lib/fwtoolkit/ext/hash_yaml.rb
fwtoolkit-2.2.4 lib/fwtoolkit/ext/hash_yaml.rb
fwtoolkit-2.2.3 lib/fwtoolkit/ext/hash_yaml.rb
fwtoolkit-2.2.2 lib/fwtoolkit/ext/hash_yaml.rb
fwtoolkit-2.2.1 lib/fwtoolkit/ext/hash_yaml.rb
fwtoolkit-2.2.0 lib/fwtoolkit/ext/hash_yaml.rb
fwtoolkit-2.1.10 lib/fwtoolkit/ext/hash_yaml.rb