Sha256: f091b4bf81a1c92b1ee5e91832f3b52449ae67119940ce8ce95a4ba2de94c41f
Contents?: true
Size: 667 Bytes
Versions: 6
Compression:
Stored size: 667 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 pathnames @pathnames ||= expand_paths end def paths @paths ||= pathnames.map(&:to_s) 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).sort end end end
Version data entries
6 entries across 6 versions & 1 rubygems