Module: RegexList::PathListExtension
- Defined in:
- lib/regex_list.rb
Overview
PathList Extension which gives sorting/filtering features to PathList
Defined Under Namespace
Modules: Assertions
Class Method Summary collapse
Instance Method Summary collapse
- #exclude_with_regex_list!(regex_list) ⇒ Object
- #grep_with_negative_regex_list!(regex_list) ⇒ Object
- #grep_with_regex_list!(regex_list) ⇒ Object
- #sort_with_regex_list!(regex_list) ⇒ Object
Class Method Details
.dup_based_method(meth) ⇒ Object
100 101 102 |
# File 'lib/regex_list.rb', line 100 def self.dup_based_method ( meth ) define_method(meth) { |regex_list| dup.send(meth.to_s + '!', regex_list) } end |
Instance Method Details
#exclude_with_regex_list!(regex_list) ⇒ Object
95 96 97 98 |
# File 'lib/regex_list.rb', line 95 def exclude_with_regex_list! ( regex_list ) reject! { |x| not regex_list.score(x.to_s).zero? } self end |
#grep_with_negative_regex_list!(regex_list) ⇒ Object
90 91 92 93 |
# File 'lib/regex_list.rb', line 90 def grep_with_negative_regex_list! ( regex_list ) sort_with_regex_list! regex_list reverse! end |
#grep_with_regex_list!(regex_list) ⇒ Object
85 86 87 88 |
# File 'lib/regex_list.rb', line 85 def grep_with_regex_list! ( regex_list ) reject! { |x| regex_list.score(x.to_s).zero? } sort_with_regex_list! regex_list end |
#sort_with_regex_list!(regex_list) ⇒ Object
81 82 83 |
# File 'lib/regex_list.rb', line 81 def sort_with_regex_list! ( regex_list ) sort! { |x, y| regex_list.score(y.to_s) <=> regex_list.score(x.to_s) } end |