Class: ActiveDirectoryForRuby::ActiveDirectoryForRubyFields

Inherits:
Object
  • Object
show all
Defined in:
lib/ActiveDirectoryForRuby.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ ActiveDirectoryForRubyFields

:nodoc:



9
10
11
# File 'lib/ActiveDirectoryForRuby.rb', line 9

def initialize(data) #:nodoc:
  @data = data
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(methodname) ⇒ Object

:nodoc:



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/ActiveDirectoryForRuby.rb', line 13

def method_missing(methodname) #:nodoc:
  strMethodName = methodname.id2name
  if strMethodName[0..4] != 'ldap_'
    raise "Method missing [#{strMethodName}]"
    return nil
  end
  symFieldName = strMethodName[5..99999].to_sym
  data = @data[symFieldName]
  data = data[0] if data.length == 1 if data.class == Array unless data.nil?
  data = nil if data.length == 0 if data.class == Array unless data.nil?
  return data
end