class Rucc::RMap

RMap – Map with recursive search

Public Class Methods

new(parent = nil) click to toggle source

@param [RMap, NilClass] parent

# File lib/rucc/rmap.rb, line 5
def initialize(parent = nil)
  @parent = parent
  @hash = {}
end

Public Instance Methods

[](k) click to toggle source
# File lib/rucc/rmap.rb, line 10
def [](k)
  v = @hash[k]
  if v.nil? && !@parent.nil?
    v = @parent[k]
  end
  v
end
[]=(k, v) click to toggle source
# File lib/rucc/rmap.rb, line 18
def []=(k, v)
  @hash[k] = v
end