Class: RuboCop::Cop::RSpec::Language::SelectorSet
- Inherits:
-
Object
- Object
- RuboCop::Cop::RSpec::Language::SelectorSet
- Defined in:
- lib/test_prof/cops/rspec/language.rb
Overview
Set of method selectors
Instance Method Summary collapse
- #+(other) ⇒ Object
- #==(other) ⇒ Object
- #block_pattern ⇒ Object
- #include?(selector) ⇒ Boolean
-
#initialize(selectors) ⇒ SelectorSet
constructor
A new instance of SelectorSet.
- #node_pattern ⇒ Object
- #node_pattern_union ⇒ Object
- #send_pattern ⇒ Object
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_pattern ⇒ Object
30 31 32 |
# File 'lib/test_prof/cops/rspec/language.rb', line 30 def block_pattern "(block #{send_pattern} ...)" end |
#include?(selector) ⇒ Boolean
26 27 28 |
# File 'lib/test_prof/cops/rspec/language.rb', line 26 def include?(selector) selectors.include?(selector) end |
#node_pattern ⇒ Object
42 43 44 |
# File 'lib/test_prof/cops/rspec/language.rb', line 42 def node_pattern selectors.map(&:inspect).join(" ") end |
#node_pattern_union ⇒ Object
38 39 40 |
# File 'lib/test_prof/cops/rspec/language.rb', line 38 def node_pattern_union "{#{node_pattern}}" end |
#send_pattern ⇒ Object
34 35 36 |
# File 'lib/test_prof/cops/rspec/language.rb', line 34 def send_pattern "(send #{RSPEC} #{node_pattern_union} ...)" end |