Sha256: 547b35801b19e5310f86eff54fa964b79b551b5ed03875594e11e2191b6d27c4
Contents?: true
Size: 611 Bytes
Versions: 75
Compression:
Stored size: 611 Bytes
Contents
require File.expand_path('../parser', __FILE__) class PathsManager def initialize(file_path) @file_path = file_path read_paths end def paths(search = nil) paths = @raw_paths.map do |raw_path| path = raw_path.sub(/^\s+when/, '').strip if path.start_with? '/' Parser.human_regex(path) else path.gsub /\A["']|["']\z/, '' end end paths.reject do |path| if search path !~ Regexp.new(search) end end end private def read_paths lines = File.readlines @file_path @raw_paths = lines.grep /^\s*when / end end
Version data entries
75 entries across 75 versions & 1 rubygems