Sha256: f1cdf8740b46af370f69b0069f41971f7de204bafe5012880ee250572837e40d
Contents?: true
Size: 717 Bytes
Versions: 2
Compression:
Stored size: 717 Bytes
Contents
# This is free and unencumbered software released into the public domain. module FFIDB class Glob attr_reader :pattern attr_reader :compiled def initialize(pattern, ignore_case: nil, match_substring: nil) @pattern = pattern.to_s regexp_pattern = Regexp.escape(@pattern).gsub('\*', '.*').gsub('\?', '.') regexp_pattern = "^#{regexp_pattern}$" unless match_substring regexp_options = ignore_case ? Regexp::IGNORECASE : nil @compiled = Regexp.new(regexp_pattern, regexp_options) end ## # @return [String] def to_s self.pattern end ## # @return [Boolean] def ===(string) self.compiled === string end end # Glob end # FFIDB
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ffidb-0.13.0 | lib/ffidb/glob.rb |
ffidb-0.12.0 | lib/ffidb/glob.rb |