Class: RuboCop::Cop::RSpec::SharedExamples::SymbolChecker
- Inherits:
-
Object
- Object
- RuboCop::Cop::RSpec::SharedExamples::SymbolChecker
- Defined in:
- lib/rubocop/cop/rspec/shared_examples.rb
Overview
:nodoc:
Constant Summary collapse
- MSG =
'Prefer %<prefer>s over `%<current>s` ' \ 'to symbolize shared examples.'
Instance Attribute Summary collapse
-
#node ⇒ Object
readonly
Returns the value of attribute node.
Instance Method Summary collapse
-
#initialize(node) ⇒ SymbolChecker
constructor
A new instance of SymbolChecker.
- #message ⇒ Object
- #preferred_style ⇒ Object
Constructor Details
#initialize(node) ⇒ SymbolChecker
Returns a new instance of SymbolChecker.
90 91 92 |
# File 'lib/rubocop/cop/rspec/shared_examples.rb', line 90 def initialize(node) @node = node end |
Instance Attribute Details
#node ⇒ Object (readonly)
Returns the value of attribute node.
88 89 90 |
# File 'lib/rubocop/cop/rspec/shared_examples.rb', line 88 def node @node end |
Instance Method Details
#message ⇒ Object
94 95 96 |
# File 'lib/rubocop/cop/rspec/shared_examples.rb', line 94 def format(MSG, prefer: preferred_style, current: node.value.inspect) end |
#preferred_style ⇒ Object
98 99 100 |
# File 'lib/rubocop/cop/rspec/shared_examples.rb', line 98 def preferred_style ":#{node.value.to_s.downcase.tr(' ', '_')}" end |