Class: Filesortd::Matcher
- Inherits:
-
Struct
- Object
- Struct
- Filesortd::Matcher
- Defined in:
- lib/filesortd/matcher.rb
Overview
Basic matcher
Direct Known Subclasses
Instance Attribute Summary collapse
-
#pattern ⇒ Object
Returns the value of attribute pattern.
Instance Method Summary collapse
Instance Attribute Details
#pattern ⇒ Object
Returns the value of attribute pattern
5 6 7 |
# File 'lib/filesortd/matcher.rb', line 5 def pattern @pattern end |
Instance Method Details
#match(s) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/filesortd/matcher.rb', line 6 def match(s) if pattern.is_a? Regexp !pattern.match(s).nil? # return a boolean through "not nil" elsif pattern.is_a? String File.fnmatch(pattern, s) end end |