Class: TagFilter

Inherits:
Object show all
Defined in:
lib/mspec/runner/filters/tag.rb

Instance Method Summary collapse

Constructor Details

#initialize(what, *tags) ⇒ TagFilter

Returns a new instance of TagFilter


4
5
6
7
# File 'lib/mspec/runner/filters/tag.rb', line 4

def initialize(what, *tags)
  @what = what
  @tags = tags
end

Instance Method Details

#loadObject


9
10
11
12
13
14
# File 'lib/mspec/runner/filters/tag.rb', line 9

def load
  desc = MSpec.read_tags(@tags).map { |t| t.description }

  @filter = MatchFilter.new(@what, *desc)
  @filter.register
end

#registerObject


20
21
22
23
# File 'lib/mspec/runner/filters/tag.rb', line 20

def register
  MSpec.register :load, self
  MSpec.register :unload, self
end

#unloadObject


16
17
18
# File 'lib/mspec/runner/filters/tag.rb', line 16

def unload
  @filter.unregister if @filter
end

#unregisterObject


25
26
27
28
# File 'lib/mspec/runner/filters/tag.rb', line 25

def unregister
  MSpec.unregister :load, self
  MSpec.unregister :unload, self
end