class Spaceship::Base::DataHash
def get(*keys)
def get(*keys) lookup(keys) end
def initialize(hash)
def initialize(hash) @hash = hash || {} end
def lookup(keys)
def lookup(keys) head, *tail = *keys if tail.empty? @hash[head] else DataHash.new(@hash[head]).lookup(tail) end end
def set(keys, value)
def set(keys, value) raise "'keys' must be an array, got #{keys.class} instead" unless keys.kind_of?(Array) last = keys.pop ref = lookup(keys) || @hash ref[last] = value end
def to_json(*a)
def to_json(*a) h = @hash.dup h.delete(:application) h.to_json(*a) end