Class: RuboCop::Cop::RSpec::AggregateExamples::Language::SelectorSet
- Inherits:
-
Object
- Object
- RuboCop::Cop::RSpec::AggregateExamples::Language::SelectorSet
- Defined in:
- lib/rubocop/cop/rspec/aggregate_examples/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.
15 16 17 |
# File 'lib/rubocop/cop/rspec/aggregate_examples/language.rb', line 15 def initialize(selectors) @selectors = selectors end |
Instance Method Details
#+(other) ⇒ Object
23 24 25 |
# File 'lib/rubocop/cop/rspec/aggregate_examples/language.rb', line 23 def +(other) self.class.new(selectors + other.selectors) end |
#==(other) ⇒ Object
19 20 21 |
# File 'lib/rubocop/cop/rspec/aggregate_examples/language.rb', line 19 def ==(other) selectors.eql?(other.selectors) end |
#block_pattern ⇒ Object
31 32 33 |
# File 'lib/rubocop/cop/rspec/aggregate_examples/language.rb', line 31 def block_pattern "(block #{send_pattern} ...)" end |
#include?(selector) ⇒ Boolean
27 28 29 |
# File 'lib/rubocop/cop/rspec/aggregate_examples/language.rb', line 27 def include?(selector) selectors.include?(selector) end |
#node_pattern ⇒ Object
43 44 45 |
# File 'lib/rubocop/cop/rspec/aggregate_examples/language.rb', line 43 def node_pattern selectors.map(&:inspect).join(' ') end |
#node_pattern_union ⇒ Object
39 40 41 |
# File 'lib/rubocop/cop/rspec/aggregate_examples/language.rb', line 39 def node_pattern_union "{#{node_pattern}}" end |
#send_pattern ⇒ Object
35 36 37 |
# File 'lib/rubocop/cop/rspec/aggregate_examples/language.rb', line 35 def send_pattern "(send #{RSPEC} #{node_pattern_union} ...)" end |