From 52fe9ba049a38c9f6d4e0f6b788cde83aff60b10 Mon Sep 17 00:00:00 2001 From: Justin Karimi Date: Thu, 17 Sep 2015 06:40:28 -0400 Subject: [PATCH] Add respond_to? Method for ADObject Add a corresponding respond_to? method for the ADObject in order to ensure that checks calling respond_to? utilize the actual fields (as most methods will not exist due to the lookup being on the symbols rather than the methods). --- lib/adauth/ad_object.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/adauth/ad_object.rb b/lib/adauth/ad_object.rb index 78681b5..c9e927f 100644 --- a/lib/adauth/ad_object.rb +++ b/lib/adauth/ad_object.rb @@ -33,6 +33,12 @@ def method_missing(method, *args) return super end + def respond_to?(method, include_private = false) + field = self.class::Fields[method] + return true if field + return super + end + def self.reverse_field(search) hash = {} self::Fields.each do |k, v|