Class: FastIgnore::Rule
- Inherits:
-
Object
- Object
- FastIgnore::Rule
- Defined in:
- lib/fast_ignore/rule.rb
Instance Attribute Summary collapse
-
#dir_only ⇒ Object
(also: #dir_only?)
readonly
Returns the value of attribute dir_only.
-
#negation ⇒ Object
(also: #negation?)
readonly
Returns the value of attribute negation.
-
#rule ⇒ Object
readonly
Returns the value of attribute rule.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#unanchored ⇒ Object
(also: #unanchored?)
readonly
Returns the value of attribute unanchored.
Instance Method Summary collapse
- #file_only? ⇒ Boolean
-
#initialize(rule, negation, unanchored = nil, dir_only = nil) ⇒ Rule
constructor
A new instance of Rule.
-
#inspect ⇒ Object
:nocov:.
-
#match?(relative_path, _, _, _) ⇒ Boolean
:nocov:.
- #shebang ⇒ Object
Constructor Details
#initialize(rule, negation, unanchored = nil, dir_only = nil) ⇒ Rule
Returns a new instance of Rule.
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/fast_ignore/rule.rb', line 20 def initialize(rule, negation, unanchored = nil, dir_only = nil) @rule = rule.is_a?(Regexp) ? rule : ::FastIgnore::FNMatchToRegex.call(rule) @unanchored = unanchored @dir_only = dir_only @negation = negation @type = negation ? 1 : 0 freeze end |
Instance Attribute Details
#dir_only ⇒ Object (readonly) Also known as: dir_only?
Returns the value of attribute dir_only.
9 10 11 |
# File 'lib/fast_ignore/rule.rb', line 9 def dir_only @dir_only end |
#negation ⇒ Object (readonly) Also known as: negation?
Returns the value of attribute negation.
5 6 7 |
# File 'lib/fast_ignore/rule.rb', line 5 def negation @negation end |
#rule ⇒ Object (readonly)
Returns the value of attribute rule.
18 19 20 |
# File 'lib/fast_ignore/rule.rb', line 18 def rule @rule end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
17 18 19 |
# File 'lib/fast_ignore/rule.rb', line 17 def type @type end |
#unanchored ⇒ Object (readonly) Also known as: unanchored?
Returns the value of attribute unanchored.
13 14 15 |
# File 'lib/fast_ignore/rule.rb', line 13 def unanchored @unanchored end |
Instance Method Details
#file_only? ⇒ Boolean
31 32 33 |
# File 'lib/fast_ignore/rule.rb', line 31 def file_only? false end |
#inspect ⇒ Object
:nocov:
40 41 42 |
# File 'lib/fast_ignore/rule.rb', line 40 def inspect "#<Rule #{'!' if @negation}#{@rule}#{'/' if @dir_only}>" end |
#match?(relative_path, _, _, _) ⇒ Boolean
:nocov:
45 46 47 |
# File 'lib/fast_ignore/rule.rb', line 45 def match?(relative_path, _, _, _) @rule.match?(relative_path) end |
#shebang ⇒ Object
35 36 37 |
# File 'lib/fast_ignore/rule.rb', line 35 def shebang nil end |