class Hash - webby-0.9.4 Documentation

# class Hash

### Public Instance Methods

sanitize!() click to toggle source

    # File lib/webby/core_ext/hash.rb, line 4
    def sanitize!
      h = self.injecting({}) do |h, (k, v)|
            h[k] = case v
                   when 'none', 'nil'; nil
                   when 'true', 'yes'; true
                   when 'false', 'no'; false
                   else v end
          end
      self.replace h
    end

stringify_keys() click to toggle source

    # File lib/webby/core_ext/hash.rb, line 15
    def stringify_keys
      h = {}
      self.each {|k,v| h[k.to_s] = v}
      return h
    end

symbolize_keys() click to toggle source

    # File lib/webby/core_ext/hash.rb, line 21
    def symbolize_keys
      h = {}
      self.each {|k,v| h[k.to_sym] = v}
      return h
    end