class FFIDB::Glob
Attributes
compiled[R]
pattern[R]
Public Class Methods
new(pattern, ignore_case: nil, match_substring: nil)
click to toggle source
# File lib/ffidb/glob.rb, line 8 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
Public Instance Methods
===(string)
click to toggle source
@return [Boolean]
# File lib/ffidb/glob.rb, line 24 def ===(string) self.compiled === string end
to_s()
click to toggle source
@return [String]
# File lib/ffidb/glob.rb, line 18 def to_s self.pattern end