Class: Redwood::LabelService

Inherits:
Object
  • Object
show all
Defined in:
lib/sup/service/label_service.rb

Overview

Provides label tweaking service to the user. Working as the backend of ConsoleMode.

Should become the backend of bin/sup-tweak-labels in the future.

Instance Method Summary collapse

Constructor Details

#initialize(index = Index.instance) ⇒ LabelService

Returns a new instance of LabelService.

Parameters:



10
11
12
# File 'lib/sup/service/label_service.rb', line 10

def initialize index=Index.instance
  @index = index
end

Instance Method Details

#add_labels(query, *labels) ⇒ Object



14
15
16
17
18
# File 'lib/sup/service/label_service.rb', line 14

def add_labels query, *labels
  run_on_each_message(query) do |m|
    labels.each {|l| m.add_label l }
  end
end

#remove_labels(query, *labels) ⇒ Object



20
21
22
23
24
# File 'lib/sup/service/label_service.rb', line 20

def remove_labels query, *labels
  run_on_each_message(query) do |m|
    labels.each {|l| m.remove_label l }
  end
end