Class: Mustermann::Shell
- Inherits:
-
Pattern
- Object
- Pattern
- Mustermann::Shell
- Defined in:
- lib/mustermann/shell.rb
Overview
Matches strings that are identical to the pattern.
Instance Method Summary collapse
- #===(string) ⇒ Object
-
#initialize(string, **options) ⇒ Shell
constructor
A new instance of Shell.
- #peek_size(string) ⇒ Object
Constructor Details
#initialize(string, **options) ⇒ Shell
Returns a new instance of Shell.
32 33 34 35 |
# File 'lib/mustermann/shell.rb', line 32 def initialize(string, **) @flags = File::FNM_PATHNAME | File::FNM_DOTMATCH | File::FNM_EXTGLOB super(string, **) end |
Instance Method Details
#===(string) ⇒ Object
40 41 42 |
# File 'lib/mustermann/shell.rb', line 40 def ===(string) File.fnmatch? @string, unescape(string), @flags end |
#peek_size(string) ⇒ Object
47 48 49 50 |
# File 'lib/mustermann/shell.rb', line 47 def peek_size(string) @peek_string ||= @string + "{**,/**,/**/*}" super if File.fnmatch? @peek_string, unescape(string), @flags end |