Class: NdrDevSupport::Rubocop::RangeAugmenter
- Inherits:
-
Object
- Object
- NdrDevSupport::Rubocop::RangeAugmenter
- Defined in:
- lib/ndr_dev_support/rubocop/range_augmenter.rb
Overview
For a given file, and set of line ranges, computes a list of all lines covered, expanding the ranges to include full method defintions, and class/module headers.
Constant Summary collapse
- MODULE_TYPES =
[:module, :class].freeze
- METHOD_TYPES =
[:def, :defs].freeze
Instance Attribute Summary collapse
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
Class Method Summary collapse
Instance Method Summary collapse
- #augmented_lines ⇒ Object
-
#initialize(filename, ranges) ⇒ RangeAugmenter
constructor
A new instance of RangeAugmenter.
Constructor Details
#initialize(filename, ranges) ⇒ RangeAugmenter
Returns a new instance of RangeAugmenter.
22 23 24 25 |
# File 'lib/ndr_dev_support/rubocop/range_augmenter.rb', line 22 def initialize(filename, ranges) @filename = filename @lines = ranges.map(&:to_a).flatten end |
Instance Attribute Details
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
10 11 12 |
# File 'lib/ndr_dev_support/rubocop/range_augmenter.rb', line 10 def filename @filename end |
Class Method Details
.augmented_lines_for(file_ranges) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/ndr_dev_support/rubocop/range_augmenter.rb', line 13 def augmented_lines_for(file_ranges) output = {} file_ranges.each do |file, ranges| output[file] = new(file, ranges).lines end output end |