From 013982e6728e85bb958337b9a667b798831c60d5 Mon Sep 17 00:00:00 2001 From: blackhedd Date: Thu, 4 May 2006 12:24:57 +0000 Subject: [PATCH] Small performance improvement --- lib/net/ldap/entry.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/net/ldap/entry.rb b/lib/net/ldap/entry.rb index fb289ea..be7798b 100644 --- a/lib/net/ldap/entry.rb +++ b/lib/net/ldap/entry.rb @@ -118,8 +118,19 @@ class LDAP alias_method :each_attribute, :each + #-- + # Convenience method to convert unknown method names + # to attribute references. Of course the method name + # comes to us as a symbol, so let's save a little time + # and not bother with the to_s.downcase two-step. + # Of course that means that a method name like mAIL + # won't work, but we shouldn't be encouraging that + # kind of bad behavior in the first place. + # Maybe we should thow something if the caller sends + # arguments or a block... + # def method_missing *args, &block # :nodoc: - s = args[0].to_s.downcase.intern + s = args[0] if attribute_names.include?(s) self[s] else