Class: Mustermann::Shell
- Inherits:
-
Pattern
- Object
- Pattern
- Mustermann::Shell
- Includes:
- Concat::Native
- 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.
34 35 36 37 |
# File 'lib/mustermann/shell.rb', line 34 def initialize(string, **) @flags = File::FNM_PATHNAME | File::FNM_DOTMATCH | File::FNM_EXTGLOB super(string, **) end |
Instance Method Details
#===(string) ⇒ Object
42 43 44 |
# File 'lib/mustermann/shell.rb', line 42 def ===(string) File.fnmatch? @string, unescape(string), @flags end |
#peek_size(string) ⇒ Object
49 50 51 52 |
# File 'lib/mustermann/shell.rb', line 49 def peek_size(string) @peek_string ||= @string + "{**,/**,/**/*}" super if File.fnmatch? @peek_string, unescape(string), @flags end |