class Hash

Public Instance Methods

car() click to toggle source
# File core/miku/hash.rb, line 6
def car
  to_a.car
end
cdr() click to toggle source
# File core/miku/hash.rb, line 10
def cdr
  to_a.car
end
convert_key(rule = nil) click to toggle source

キーの名前を変換する。

# File core/utils.rb, line 348
def convert_key(rule = nil)
  result = {}
  self.each_pair { |key, val|
    if rule[key]
      result[rule[key]] = val
    else
      result[key.to_sym] = val end }
  result end
setcar(val) click to toggle source
# File core/miku/hash.rb, line 17
def setcar(val)
  to_a.setcar(val)
end
setcdr(val) click to toggle source
# File core/miku/hash.rb, line 21
def setcdr(val)
  to_a.setcdr(val)
end
symbolize() click to toggle source

キーを全てto_symしたhashを新たにつくる

# File core/utils.rb, line 358
def symbolize
  result = {}
  each_pair { |key, val|
    result[key.to_sym] = if val.respond_to?(:symbolize) then val.symbolize else val end }
  result
end
terminator() click to toggle source
# File core/miku/hash.rb, line 14
def terminator
  nil end
unparse(start=true) click to toggle source
# File core/miku/hash.rb, line 25
def unparse(start=true)
  "#hash(" + map{ |n| "#{n[0]} #{n[1]}" }.join(" ") + ')'
end