Class: FastIgnore::GitignoreRuleScanner
- Inherits:
-
StringScanner
- Object
- StringScanner
- FastIgnore::GitignoreRuleScanner
- Defined in:
- lib/fast_ignore/gitignore_rule_scanner.rb
Instance Method Summary collapse
- #backslash? ⇒ Boolean
- #character_class_end? ⇒ Boolean
- #character_class_literal ⇒ Object
- #character_class_negation? ⇒ Boolean
- #character_class_range_end ⇒ Object
- #character_class_range_start ⇒ Object
- #character_class_start? ⇒ Boolean
- #end? ⇒ Boolean
- #exclamation_mark? ⇒ Boolean
- #hash? ⇒ Boolean
- #literal ⇒ Object
- #next_character ⇒ Object
- #question_mark? ⇒ Boolean
- #significant_whitespace ⇒ Object
- #slash? ⇒ Boolean
- #star? ⇒ Boolean
- #star_end? ⇒ Boolean
- #star_slash_end? ⇒ Boolean
- #two_star_end? ⇒ Boolean
- #two_star_slash_end? ⇒ Boolean
- #two_stars? ⇒ Boolean
Instance Method Details
#backslash? ⇒ Boolean
25 26 27 |
# File 'lib/fast_ignore/gitignore_rule_scanner.rb', line 25 def backslash? skip(/\\/) end |
#character_class_end? ⇒ Boolean
5 6 7 |
# File 'lib/fast_ignore/gitignore_rule_scanner.rb', line 5 def character_class_end? skip(/\]/) end |
#character_class_literal ⇒ Object
61 62 63 |
# File 'lib/fast_ignore/gitignore_rule_scanner.rb', line 61 def character_class_literal matched if scan(/[^\]\\][^\]\\-]*(?!-)/) end |
#character_class_negation? ⇒ Boolean
13 14 15 |
# File 'lib/fast_ignore/gitignore_rule_scanner.rb', line 13 def character_class_negation? skip(/\^|!/) end |
#character_class_range_end ⇒ Object
69 70 71 72 73 74 75 |
# File 'lib/fast_ignore/gitignore_rule_scanner.rb', line 69 def character_class_range_end # we already confirmed this was going to match # with the lookahead in character_class_range_start skip(/-/) scan(/(\\.|[^\\\]])/) matched end |
#character_class_range_start ⇒ Object
65 66 67 |
# File 'lib/fast_ignore/gitignore_rule_scanner.rb', line 65 def character_class_range_start matched if scan(/(\\.|[^\\\]])(?=-(\\.|[^\\\]]))/) end |
#character_class_start? ⇒ Boolean
9 10 11 |
# File 'lib/fast_ignore/gitignore_rule_scanner.rb', line 9 def character_class_start? skip(/\[/) end |
#end? ⇒ Boolean
17 18 19 |
# File 'lib/fast_ignore/gitignore_rule_scanner.rb', line 17 def end? skip(/\s*\z/) end |
#exclamation_mark? ⇒ Boolean
85 86 87 |
# File 'lib/fast_ignore/gitignore_rule_scanner.rb', line 85 def exclamation_mark? skip(/!/) end |
#hash? ⇒ Boolean
89 90 91 |
# File 'lib/fast_ignore/gitignore_rule_scanner.rb', line 89 def hash? skip(/#/) end |
#literal ⇒ Object
77 78 79 |
# File 'lib/fast_ignore/gitignore_rule_scanner.rb', line 77 def literal matched if scan(%r{[^*/?\[\\\s]+}) end |
#next_character ⇒ Object
37 38 39 |
# File 'lib/fast_ignore/gitignore_rule_scanner.rb', line 37 def next_character matched if scan(/./) end |
#question_mark? ⇒ Boolean
57 58 59 |
# File 'lib/fast_ignore/gitignore_rule_scanner.rb', line 57 def question_mark? skip(/\?/) end |
#significant_whitespace ⇒ Object
81 82 83 |
# File 'lib/fast_ignore/gitignore_rule_scanner.rb', line 81 def significant_whitespace matched if scan(/\s+(?!\s|\z)/) end |
#slash? ⇒ Boolean
21 22 23 |
# File 'lib/fast_ignore/gitignore_rule_scanner.rb', line 21 def slash? skip(%r{/}) end |
#star? ⇒ Boolean
33 34 35 |
# File 'lib/fast_ignore/gitignore_rule_scanner.rb', line 33 def star? skip(/\*/) end |
#star_end? ⇒ Boolean
41 42 43 |
# File 'lib/fast_ignore/gitignore_rule_scanner.rb', line 41 def star_end? skip(/\*\s*\z/) end |
#star_slash_end? ⇒ Boolean
49 50 51 |
# File 'lib/fast_ignore/gitignore_rule_scanner.rb', line 49 def star_slash_end? skip(%r{\*/\s*\z}) end |
#two_star_end? ⇒ Boolean
45 46 47 |
# File 'lib/fast_ignore/gitignore_rule_scanner.rb', line 45 def two_star_end? skip(/\*{2,}\s*\z/) end |
#two_star_slash_end? ⇒ Boolean
53 54 55 |
# File 'lib/fast_ignore/gitignore_rule_scanner.rb', line 53 def two_star_slash_end? skip(%r{\*{2,}/\s*\z}) end |
#two_stars? ⇒ Boolean
29 30 31 |
# File 'lib/fast_ignore/gitignore_rule_scanner.rb', line 29 def two_stars? skip(/\*{2,}/) end |