Module: Rubocop::Cop::Util
- Defined in:
- lib/rubocop/cop/util.rb
Overview
This module contains a collection of useful utility methods.
Class Method Summary collapse
Class Method Details
.block_length(block_node) ⇒ Object
22 23 24 |
# File 'lib/rubocop/cop/util.rb', line 22 def block_length(block_node) block_node.loc.end.line - block_node.loc.begin.line end |
.strip_quotes(str) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/rubocop/cop/util.rb', line 9 def strip_quotes(str) if str[0] == '"' || str[0] == "'" str[0] = '' str[-1] = '' else # we're dealing with %q or %Q str[0, 3] = '' str[-1] = '' end str end |