Sha256: 6c4563d95ea2562e55f27ab30ba897d5d3846b04bfba0ee4c5055eccf48fbb4e
Contents?: true
Size: 628 Bytes
Versions: 211
Compression:
Stored size: 628 Bytes
Contents
# frozen_string_literal: true module RuboCop module Cop # This class ensures a require statement is present for a standard library # determined by the variable library_name class RequireLibraryCorrector extend RangeHelp class << self def correct(corrector, node, library_name) node = node.parent while node.parent? node = node.children.first if node.begin_type? corrector.insert_before(node, require_statement(library_name)) end def require_statement(library_name) "require '#{library_name}'\n" end end end end end
Version data entries
211 entries across 202 versions & 19 rubygems