Class: RuboCop::RSpec::Hook
Overview
Instance Method Summary
collapse
Methods inherited from Concept
#eql?, #hash, #initialize, #to_node
#block_pattern, #send_pattern
Instance Method Details
#example? ⇒ Boolean
23
24
25
|
# File 'lib/rubocop/rspec/hook.rb', line 23
def example?
scope.equal?(:each)
end
|
#knowable_scope? ⇒ Boolean
17
18
19
20
21
|
# File 'lib/rubocop/rspec/hook.rb', line 17
def knowable_scope?
scope_argument.nil? ||
scope_argument.sym_type? ||
scope_argument.hash_type?
end
|
37
38
39
40
41
42
|
# File 'lib/rubocop/rspec/hook.rb', line 37
def metadata
((node) || [])
.map { |meta| transform_metadata(meta) }
.flatten
.inject(&:merge)
end
|
#name ⇒ Object
13
14
15
|
# File 'lib/rubocop/rspec/hook.rb', line 13
def name
node.method_name
end
|
#scope ⇒ Object
27
28
29
30
31
32
33
34
35
|
# File 'lib/rubocop/rspec/hook.rb', line 27
def scope
return :each if scope_argument&.hash_type?
case scope_name
when nil, :each, :example then :each
when :context, :all then :context
when :suite then :suite
end
end
|