Class: DatabaseCleaner::Ldap::Deletion

Inherits:
Strategy
  • Object
show all
Defined in:
lib/database_cleaner/ldap/deletion.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Deletion

Returns a new instance of Deletion.

Raises:

  • (ArgumentError)


8
9
10
11
12
13
# File 'lib/database_cleaner/ldap/deletion.rb', line 8

def initialize(opts={})
  raise ArgumentError,
    "Option :filter must be a Net::LDAP::Filter" unless opts.empty? || opts[:filter].is_a?(Net::LDAP::Filter)

  @filter = opts[:filter]
end

Instance Attribute Details

#filterObject (readonly)

Returns the value of attribute filter.



6
7
8
# File 'lib/database_cleaner/ldap/deletion.rb', line 6

def filter
  @filter
end

Instance Method Details

#cleanObject



15
16
17
# File 'lib/database_cleaner/ldap/deletion.rb', line 15

def clean
  entries.each { |ldap_entry| delete! ldap_entry.dn }
end

#dbObject



19
20
21
# File 'lib/database_cleaner/ldap/deletion.rb', line 19

def db
  @db ||= Net::LDAP.new
end