Sha256: ea869c224e89a4512776a0e3527b6079451aebd5beddd1337319f7bfb26dd6e2
Contents?: true
Size: 654 Bytes
Versions: 4
Compression:
Stored size: 654 Bytes
Contents
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 <gm@navel.gr>
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
glue-0.28.0 | lib/glue/flexob.rb |
glue-0.27.0 | lib/glue/flexob.rb |
glue-0.29.0 | lib/glue/flexob.rb |
glue-0.30.0 | lib/glue/flexob.rb |