Class: Mustermann::Shell
Overview
Matches strings that are identical to the pattern.
Constant Summary
Constants inherited from Pattern
Constants included from Mustermann
Instance Method Summary collapse
-
#===(string) ⇒ Boolean
Whether or not the pattern matches the given string.
- #initialize(string, options = {}) ⇒ Shell, Pattern constructor
-
#peek_size(string) ⇒ Integer?
The number of characters that match.
Methods inherited from Pattern
#&, #=~, #^, #expand, #match, #named_captures, #names, new, #params, #peek, #peek_match, #peek_params, supported?, supported_options, #to_proc, #to_s, #to_templates, #|
Methods included from Mustermann
Constructor Details
Instance Method Details
#===(string) ⇒ Boolean
Returns Whether or not the pattern matches the given string.
27 28 29 |
# File 'lib/mustermann/shell.rb', line 27 def ===(string) File.fnmatch? @string, unescape(string), @flags end |
#peek_size(string) ⇒ Integer?
Returns the number of characters that match.
34 35 36 37 |
# File 'lib/mustermann/shell.rb', line 34 def peek_size(string) @peek_string ||= @string + "{**,/**,/**/*}" super if File.fnmatch? @peek_string, unescape(string), @flags end |