Class: FastIgnore::Matchers::AllowPathRegexp
- Inherits:
-
Object
- Object
- FastIgnore::Matchers::AllowPathRegexp
- Defined in:
- lib/fast_ignore/matchers/allow_path_regexp.rb
Instance Attribute Summary collapse
-
#dir_only ⇒ Object
(also: #dir_only?)
readonly
Returns the value of attribute dir_only.
-
#rule ⇒ Object
readonly
Returns the value of attribute rule.
-
#squash_id ⇒ Object
readonly
Returns the value of attribute squash_id.
Instance Method Summary collapse
- #file_only? ⇒ Boolean
-
#initialize(rule, squashable, dir_only) ⇒ AllowPathRegexp
constructor
A new instance of AllowPathRegexp.
-
#inspect ⇒ Object
:nocov:.
-
#match?(candidate) ⇒ Boolean
:nocov:.
- #squash(list) ⇒ Object
- #weight ⇒ Object
Constructor Details
#initialize(rule, squashable, dir_only) ⇒ AllowPathRegexp
Returns a new instance of AllowPathRegexp.
13 14 15 16 17 18 19 20 |
# File 'lib/fast_ignore/matchers/allow_path_regexp.rb', line 13 def initialize(rule, squashable, dir_only) @rule = rule @dir_only = dir_only @squashable = squashable @squash_id = squashable ? :allow : object_id freeze end |
Instance Attribute Details
#dir_only ⇒ Object (readonly) Also known as: dir_only?
Returns the value of attribute dir_only.
6 7 8 |
# File 'lib/fast_ignore/matchers/allow_path_regexp.rb', line 6 def dir_only @dir_only end |
#rule ⇒ Object (readonly)
Returns the value of attribute rule.
11 12 13 |
# File 'lib/fast_ignore/matchers/allow_path_regexp.rb', line 11 def rule @rule end |
#squash_id ⇒ Object (readonly)
Returns the value of attribute squash_id.
10 11 12 |
# File 'lib/fast_ignore/matchers/allow_path_regexp.rb', line 10 def squash_id @squash_id end |
Instance Method Details
#file_only? ⇒ Boolean
26 27 28 |
# File 'lib/fast_ignore/matchers/allow_path_regexp.rb', line 26 def file_only? false end |
#inspect ⇒ Object
:nocov:
35 36 37 |
# File 'lib/fast_ignore/matchers/allow_path_regexp.rb', line 35 def inspect "#<AllowPathRegexp #{'dir_only ' if @dir_only}#{@rule.inspect}>" end |
#match?(candidate) ⇒ Boolean
:nocov:
40 41 42 |
# File 'lib/fast_ignore/matchers/allow_path_regexp.rb', line 40 def match?(candidate) :allow if @rule.match?(candidate.relative_path) end |
#squash(list) ⇒ Object
22 23 24 |
# File 'lib/fast_ignore/matchers/allow_path_regexp.rb', line 22 def squash(list) self.class.new(::Regexp.union(list.map(&:rule)), @squashable, @dir_only) end |
#weight ⇒ Object
30 31 32 |
# File 'lib/fast_ignore/matchers/allow_path_regexp.rb', line 30 def weight 1 end |