Class: Exclusions
- Inherits:
-
Object
- Object
- Exclusions
- Defined in:
- lib/exclusions.rb
Instance Attribute Summary collapse
-
#patterns ⇒ Object
readonly
Returns the value of attribute patterns.
Instance Method Summary collapse
-
#initialize(patterns) ⇒ Exclusions
constructor
A new instance of Exclusions.
- #match(str) ⇒ Object
Constructor Details
#initialize(patterns) ⇒ Exclusions
Returns a new instance of Exclusions.
4 5 6 |
# File 'lib/exclusions.rb', line 4 def initialize(patterns) @patterns = patterns.map {|p| /#{p}/} unless patterns.nil? end |
Instance Attribute Details
#patterns ⇒ Object (readonly)
Returns the value of attribute patterns.
2 3 4 |
# File 'lib/exclusions.rb', line 2 def patterns @patterns end |
Instance Method Details
#match(str) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/exclusions.rb', line 8 def match(str) return false if patterns.nil? patterns.any? { |p| p.match(str) } end |