Sha256: 794ba8fd44a3361311d2eac4da775e5ac412cd1094efaef81632183dec0611c9
Contents?: true
Size: 662 Bytes
Versions: 2
Compression:
Stored size: 662 Bytes
Contents
require "pathname" module Rubycritic class SourceLocator RUBY_EXTENSION = ".rb" RUBY_FILES = File.join("**", "*#{RUBY_EXTENSION}") def initialize(paths) @initial_paths = paths end def paths @paths ||= pathnames.map(&:to_s) end def pathnames @pathnames ||= expand_paths end private def expand_paths @initial_paths.map do |path| if File.directory?(path) Pathname.glob(File.join(path, RUBY_FILES)) elsif File.exists?(path) && File.extname(path) == RUBY_EXTENSION Pathname.new(path) end end.flatten.compact.map(&:cleanpath) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rubycritic-1.1.1 | lib/rubycritic/source_locator.rb |
rubycritic-1.1.0 | lib/rubycritic/source_locator.rb |