Class: RuboCop::Cop::RSpec::SharedExamples::StringChecker
- Inherits:
-
Object
- Object
- RuboCop::Cop::RSpec::SharedExamples::StringChecker
- Defined in:
- lib/rubocop/cop/rspec/shared_examples.rb
Overview
:nodoc:
Constant Summary collapse
- MSG =
'Prefer %<prefer>s over `%<current>s` ' \ 'to titleize shared examples.'
Instance Attribute Summary collapse
-
#node ⇒ Object
readonly
Returns the value of attribute node.
Instance Method Summary collapse
-
#initialize(node) ⇒ StringChecker
constructor
A new instance of StringChecker.
- #message ⇒ Object
- #preferred_style ⇒ Object
Constructor Details
#initialize(node) ⇒ StringChecker
Returns a new instance of StringChecker.
110 111 112 |
# File 'lib/rubocop/cop/rspec/shared_examples.rb', line 110 def initialize(node) @node = node end |
Instance Attribute Details
#node ⇒ Object (readonly)
Returns the value of attribute node.
108 109 110 |
# File 'lib/rubocop/cop/rspec/shared_examples.rb', line 108 def node @node end |
Instance Method Details
#message ⇒ Object
114 115 116 |
# File 'lib/rubocop/cop/rspec/shared_examples.rb', line 114 def format(MSG, prefer: preferred_style, current: node.value.inspect) end |
#preferred_style ⇒ Object
118 119 120 |
# File 'lib/rubocop/cop/rspec/shared_examples.rb', line 118 def preferred_style "'#{node.value.to_s.tr('_', ' ')}'" end |