Class: Togglefy::BulkToggler

Inherits:
Object
  • Object
show all
Defined in:
lib/togglefy/services/bulk_toggler.rb

Overview

The BulkToggler class provides functionality to enable or disable features in bulk for assignables, such as users or accounts.

Constant Summary collapse

ALLOWED_ASSIGNABLE_FILTERS =

List of allowed filters for assignables.

i[group role environment env tenant_id].freeze

Instance Method Summary collapse

Constructor Details

#initialize(klass) ⇒ BulkToggler

Initializes a new BulkToggler instance.



13
14
15
# File 'lib/togglefy/services/bulk_toggler.rb', line 13

def initialize(klass)
  @klass = klass
end

Instance Method Details

#disable(identifiers, **filters) ⇒ Object

Note:

All parameters but the first (identifiers) should be passed as keyword arguments.

Disables features for assignables based on filters.



42
43
44
45
# File 'lib/togglefy/services/bulk_toggler.rb', line 42

def disable(identifiers, **filters)
  toggle(:disable, identifiers, filters)
  true
end

#enable(identifiers, **filters) ⇒ Object

Note:

All parameters but the first (identifiers) should be passed as keyword arguments.

Enables features for assignables based on filters.



27
28
29
30
# File 'lib/togglefy/services/bulk_toggler.rb', line 27

def enable(identifiers, **filters)
  toggle(:enable, identifiers, filters)
  true
end