class Kudzu::Common
Public Class Methods
match?(text, pattern)
click to toggle source
# File lib/kudzu/common.rb, line 4 def match?(text, pattern) if pattern.is_a?(String) File.fnmatch(pattern, text) elsif pattern.is_a?(Regexp) text =~ pattern else false end end
path_to_dir(path)
click to toggle source
# File lib/kudzu/common.rb, line 14 def path_to_dir(path) if path.end_with?('/') path else dir = File.dirname(path) dir.end_with?('/') ? dir : dir + '/' end end