Sha256: b7334b3c1af24ecc672f124dd7bb7aaa8bded2c89266e195e8f301b81d19ba26

Contents?: true

Size: 423 Bytes

Versions: 4

Compression:

Stored size: 423 Bytes

Contents

class Value < Hash
  def [](val)
    super(val.to_s)
  end

  def []=(name, val)
    super(name.to_s, val)
  end

  def method_missing(name, *args)
    if name.to_s[-1] == '='
      name = name[0 .. -2]
      self[name] = args[0]
      (class << self; self; end).class_eval(<<-EOF)
        def #{name}; self["#{name}"]; end
        def #{name}=(v); self["#{name}"] = v; end
      EOF
    else
      super
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dicer-0.3.0 spec/support/value.rb
dicer-0.2.0 spec/support/value.rb
dicer-0.1.0 spec/support/value.rb
dicer-0.0.1 spec/support/value.rb