require 'ostruct' module Glue # A flexible Object. # Temporarily implemented as a simple OpenStruct. class Flexob < OpenStruct def update(hash) hash.each do |k, v| send("#{k}=", v) end end alias_method :set, :update alias_method :merge, :update def fetch(key, default = nil) if @table.has_key?(key) @table[key.to_sym] else default end end def []=(key, val) @table[key.to_sym] = val end def [](key) @table[key.to_sym] end def each(&block) @table.each(&block) end def has_key?(key) @table.has_key?(key) end end end # * George Moschovitis