Class: Wool::ExtraWhitespaceWarning

Inherits:
LineWarning show all
Defined in:
lib/wool/warnings/extra_whitespace.rb

Overview

Warning for having extra space at the end of a line.

Instance Attribute Summary

Attributes inherited from Warning

#body, #file, #line_number, #name, #settings, #severity

Instance Method Summary collapse

Methods inherited from LineWarning

options

Methods inherited from Warning

all_types, all_warnings, concrete_warnings, #count_occurrences, #desc, #fixable?, #generated_warnings, #get_indent, #indent, inherited, #initialize, opt, options, setting_accessor, type

Methods included from Advice

#advice_counter, #after_advice, #argument_advice, #before_advice, #bump_advice_counter!, #with_advice

Methods included from ModuleExtensions

#attr_accessor_with_default, #cattr_accessor, #cattr_accessor_with_default, #cattr_get_and_setter, #cattr_reader, #cattr_writer

Methods included from SexpAnalysis

#find_sexps, #parse

Methods included from LexicalAnalysis

#find_keyword, #find_token, #lex, #select_token, #split_on_keyword, #split_on_token, #text_between_token_positions

Constructor Details

This class inherits a constructor from Wool::Warning

Instance Method Details

#fixObject



12
13
14
# File 'lib/wool/warnings/extra_whitespace.rb', line 12

def fix
  self.line.gsub(/\s+$/, '')
end

#match?(body = self.body) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/wool/warnings/extra_whitespace.rb', line 8

def match?(body = self.body)
  /\s+$/ === line
end