Class: RuboCop::RSpec::AlignLetBrace

Inherits:
Object
  • Object
show all
Extended by:
NodePattern::Macros
Defined in:
lib/rubocop/rspec/align_let_brace.rb

Overview

Shared behavior for aligning braces for single line lets

Instance Method Summary collapse

Constructor Details

#initialize(root, token) ⇒ AlignLetBrace

Returns a new instance of AlignLetBrace.



11
12
13
14
# File 'lib/rubocop/rspec/align_let_brace.rb', line 11

def initialize(root, token)
  @root  = root
  @token = token
end

Instance Method Details

#indent_for(node) ⇒ Object



22
23
24
# File 'lib/rubocop/rspec/align_let_brace.rb', line 22

def indent_for(node)
  ' ' * (target_column_for(node) - let_token(node).column)
end

#offending_tokensObject



16
17
18
19
20
# File 'lib/rubocop/rspec/align_let_brace.rb', line 16

def offending_tokens
  single_line_lets.reject do |let|
    target_column_for(let) == let_token(let).column
  end
end