2010/5/15 Une Bue <unbewusst.sein / google.com.invalid>:
> def [a_key]
> eturn nil unless @attr.keys.include?(a_key)
> eturn @attr[a_key]
> end

  def []( a_key )
    return @attr[a_key]
  end

but yes, that's a good option. By default hashes return nil when you
dereference a key that doesn't exist, so unless you've changed that
(by creating it with Hash.new(...) or similar) then you can leave that
first line out.

Ben