Class: Moose::Inventory::Operations::RemoveGroups
- Inherits:
-
Object
- Object
- Moose::Inventory::Operations::RemoveGroups
- Defined in:
- lib/moose_inventory/operations/remove_groups.rb
Overview
Removes top-level groups and their direct associations.
Defined Under Namespace
Instance Method Summary collapse
- #call(names:, recursive: false) ⇒ Object
-
#initialize(context:) ⇒ RemoveGroups
constructor
A new instance of RemoveGroups.
Constructor Details
#initialize(context:) ⇒ RemoveGroups
Returns a new instance of RemoveGroups.
13 14 15 16 17 18 19 |
# File 'lib/moose_inventory/operations/remove_groups.rb', line 13 def initialize(context:) @context = context @cleanup = Moose::Inventory::Operations::GroupCleanup.new( context: context, emitter: method(:emit) ) end |
Instance Method Details
#call(names:, recursive: false) ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/moose_inventory/operations/remove_groups.rb', line 21 def call(names:, recursive: false) events = [] warning_count = 0 names.each do |name| warning_count += remove_group(name, events, recursive: recursive) end Result.new(events: events, warning_count: warning_count) end |