Sha256: 040ff056b14ebb0463bd50d99fe2632f5df70420cc2fe82dfff2da217cfd303c

Contents?: true

Size: 430 Bytes

Versions: 4

Compression:

Stored size: 430 Bytes

Contents

require 'ostruct'

# 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

  def []=(key, val)
    @table[key.to_sym] = val
  end  
  
  def [](key)
    @table[key.to_sym]
  end

  def each(&block)
    @table.each(&block)
  end    
  
end

# * George Moschovitis <gm@navel.gr>

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
glue-0.21.2 lib/glue/flexob.rb
glue-0.22.0 lib/glue/flexob.rb
glue-0.21.0 lib/glue/flexob.rb
glue-0.23.0 lib/glue/flexob.rb