class Hermes::URLText::Dict

Public Class Methods

new() { |self| ... } click to toggle source
Calls superclass method
# File lib/hermes/escape.rb, line 340
def initialize
  super
  yield self if block_given?
end

Public Instance Methods

[](key) click to toggle source
Calls superclass method
# File lib/hermes/escape.rb, line 344
def [] key
  super key.to_sym
end
[]=(key, val) click to toggle source
Calls superclass method
# File lib/hermes/escape.rb, line 347
def []= key, val
  super key.to_sym, val
end
create() { |i| ... } click to toggle source
# File lib/hermes/escape.rb, line 334
def create
  i = new
  yield i
  i
end
merge!(hash)
Alias for: update
method_missing(sym, *args) click to toggle source
Calls superclass method
# File lib/hermes/escape.rb, line 361
def method_missing sym, *args
  if args.empty? and not sym =~ /[!?=]\z/ then
    self[ sym]
  else
    first, *rest = args
    if rest.empty? and sym =~ /=\z/ then
      self[ sym] = first
    else
      super
    end
  end
end
parse(key, val) click to toggle source
# File lib/hermes/escape.rb, line 354
def parse key, val
  self[ key] = case val
    when nil                             then nil
    when /\A(?:[+-]?[1-9][0-9]{,9}|0)\z/ then val.to_i
    else                                      val.to_s.notempty?
  end
end
update(hash) click to toggle source
# File lib/hermes/escape.rb, line 350
def update hash
  hash.each { |k,v| self[ k] = v }
end
Also aliased as: merge!