Sha256: b8805c8eceee58a6717576805690625983020bd00be28fa254f9991513fa6c3c
Contents?: true
Size: 627 Bytes
Versions: 3
Compression:
Stored size: 627 Bytes
Contents
module Bukin class FileMatch def initialize(search) @search = search end def match(file_name) match_helper(@search, file_name) end alias_method :=~, :match def self.any FileMatch.new(true) end private def match_helper(search, file_name) if search == true || search == false search elsif search.is_a? ::String search == file_name elsif search.is_a? ::Regexp search =~ file_name elsif search.respond_to? :any? search.any? {|item| match_helper(item, file_name)} else false end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
bukin-0.9.0 | lib/bukin/file_match.rb |
bukin-0.8.0 | lib/bukin/file_match.rb |
bukin-0.7.0 | lib/bukin/file_match.rb |