Class: PathList::Matchers::IgnorePathRegexp
- Inherits:
-
Object
- Object
- PathList::Matchers::IgnorePathRegexp
- Defined in:
- lib/path_list/matchers/ignore_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, anchored, dir_only) ⇒ IgnorePathRegexp
constructor
A new instance of IgnorePathRegexp.
-
#inspect ⇒ Object
:nocov:.
-
#match?(candidate) ⇒ Boolean
:nocov:.
- #shebang? ⇒ Boolean
- #squash(list) ⇒ Object
Constructor Details
#initialize(rule, anchored, dir_only) ⇒ IgnorePathRegexp
Returns a new instance of IgnorePathRegexp.
13 14 15 16 17 18 19 20 |
# File 'lib/path_list/matchers/ignore_path_regexp.rb', line 13 def initialize(rule, anchored, dir_only) @rule = rule @dir_only = dir_only @anchored = anchored @squash_id = anchored ? :ignore : 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/path_list/matchers/ignore_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/path_list/matchers/ignore_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/path_list/matchers/ignore_path_regexp.rb', line 10 def squash_id @squash_id end |
Instance Method Details
#file_only? ⇒ Boolean
26 27 28 |
# File 'lib/path_list/matchers/ignore_path_regexp.rb', line 26 def file_only? false end |
#inspect ⇒ Object
:nocov:
35 36 37 |
# File 'lib/path_list/matchers/ignore_path_regexp.rb', line 35 def inspect "#<IgnorePathRegexp #{'dir_only ' if @dir_only}#{@rule.inspect}>" end |
#match?(candidate) ⇒ Boolean
:nocov:
40 41 42 |
# File 'lib/path_list/matchers/ignore_path_regexp.rb', line 40 def match?(candidate) :ignore if @rule.match?(candidate.relative_path) end |
#shebang? ⇒ Boolean
30 31 32 |
# File 'lib/path_list/matchers/ignore_path_regexp.rb', line 30 def shebang? false end |
#squash(list) ⇒ Object
22 23 24 |
# File 'lib/path_list/matchers/ignore_path_regexp.rb', line 22 def squash(list) self.class.new(::Regexp.union(list.map(&:rule)), @anchored, @dir_only) end |