Class: RuboCop::Cop::RSpec::Language::SelectorSet

Inherits:
Object
  • Object
show all
Defined in:
lib/test_prof/cops/rspec/language.rb

Overview

Set of method selectors

Instance Method Summary collapse

Constructor Details

#initialize(selectors) ⇒ SelectorSet

Returns a new instance of SelectorSet.



14
15
16
# File 'lib/test_prof/cops/rspec/language.rb', line 14

def initialize(selectors)
  @selectors = selectors
end

Instance Method Details

#+(other) ⇒ Object



22
23
24
# File 'lib/test_prof/cops/rspec/language.rb', line 22

def +(other)
  self.class.new(selectors + other.selectors)
end

#==(other) ⇒ Object



18
19
20
# File 'lib/test_prof/cops/rspec/language.rb', line 18

def ==(other)
  selectors.eql?(other.selectors)
end

#block_patternObject



30
31
32
# File 'lib/test_prof/cops/rspec/language.rb', line 30

def block_pattern
  "(block #{send_pattern} ...)"
end

#include?(selector) ⇒ Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/test_prof/cops/rspec/language.rb', line 26

def include?(selector)
  selectors.include?(selector)
end

#node_patternObject



42
43
44
# File 'lib/test_prof/cops/rspec/language.rb', line 42

def node_pattern
  selectors.map(&:inspect).join(" ")
end

#node_pattern_unionObject



38
39
40
# File 'lib/test_prof/cops/rspec/language.rb', line 38

def node_pattern_union
  "{#{node_pattern}}"
end

#send_patternObject



34
35
36
# File 'lib/test_prof/cops/rspec/language.rb', line 34

def send_pattern
  "(send #{RSPEC} #{node_pattern_union} ...)"
end