Class: DatabaseCleaner::Ldap::Deletion
- Inherits:
-
Strategy
- Object
- Strategy
- DatabaseCleaner::Ldap::Deletion
- Defined in:
- lib/database_cleaner/ldap/deletion.rb
Instance Attribute Summary collapse
-
#filter ⇒ Object
readonly
Returns the value of attribute filter.
Instance Method Summary collapse
- #clean ⇒ Object
- #db ⇒ Object
-
#initialize(opts = {}) ⇒ Deletion
constructor
A new instance of Deletion.
Constructor Details
#initialize(opts = {}) ⇒ Deletion
Returns a new instance of Deletion.
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
#filter ⇒ Object (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
#clean ⇒ Object
15 16 17 |
# File 'lib/database_cleaner/ldap/deletion.rb', line 15 def clean entries.each { |ldap_entry| delete! ldap_entry.dn } end |
#db ⇒ Object
19 20 21 |
# File 'lib/database_cleaner/ldap/deletion.rb', line 19 def db @db ||= Net::LDAP.new end |