Sha256: 05f03ed50e3e584217d01091e3c99c02b46b22e695161fc520d2b9317b745e78
Contents?: true
Size: 712 Bytes
Versions: 12
Compression:
Stored size: 712 Bytes
Contents
module Netzke module Core # Allows deep-nested configuration without previously defining the hash tree: # # config = Netzke::Core::OptionsHash.new # config.basepack.grid_panel.add_form.with_tools = true # config # => {:basepack=>{:grid_panel=>{:add_form=>{:with_tools=>true}}}} class OptionsHash < ::Hash def []=(key, value) super(key.to_sym, value) end def [](key) super(key.to_sym) end def method_missing(name, *args) if name.to_s =~ /(.*)=$/ self[$1.to_sym] = args.first else self.has_key?(name) ? self[name] : self[name] = OptionsHash.new end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems