Class: RuboCop::RSpec::AlignLetBrace
- Inherits:
-
Object
- Object
- RuboCop::RSpec::AlignLetBrace
- Includes:
- Cop::Util, Language
- Defined in:
- lib/rubocop/rspec/align_let_brace.rb
Overview
Shared behavior for aligning braces for single line lets
Instance Method Summary collapse
- #indent_for(node) ⇒ Object
-
#initialize(root, token) ⇒ AlignLetBrace
constructor
A new instance of AlignLetBrace.
- #offending_tokens ⇒ Object
Methods included from Language
#example?, #example_group?, #example_group_with_body?, #explicit_rspec?, #hook?, #include?, #let?, #rspec?, #shared_group?, #spec_group?, #subject?
Constructor Details
#initialize(root, token) ⇒ AlignLetBrace
Returns a new instance of AlignLetBrace.
10 11 12 13 |
# File 'lib/rubocop/rspec/align_let_brace.rb', line 10 def initialize(root, token) @root = root @token = token end |
Instance Method Details
#indent_for(node) ⇒ Object
21 22 23 |
# File 'lib/rubocop/rspec/align_let_brace.rb', line 21 def indent_for(node) ' ' * (target_column_for(node) - let_token(node).column) end |
#offending_tokens ⇒ Object
15 16 17 18 19 |
# File 'lib/rubocop/rspec/align_let_brace.rb', line 15 def offending_tokens single_line_lets.reject do |let| target_column_for(let) == let_token(let).column end end |