Class: GitComitter::PatternMatcher
- Inherits:
-
Object
- Object
- GitComitter::PatternMatcher
- Defined in:
- lib/git-comitter/commit.rb
Instance Method Summary collapse
-
#initialize(patterns, &block) ⇒ PatternMatcher
constructor
A new instance of PatternMatcher.
- #match(commits) ⇒ Object
Constructor Details
#initialize(patterns, &block) ⇒ PatternMatcher
Returns a new instance of PatternMatcher.
3 4 5 6 |
# File 'lib/git-comitter/commit.rb', line 3 def initialize(patterns, &block) @patterns = patterns @commit_property = block end |
Instance Method Details
#match(commits) ⇒ Object
8 9 10 11 |
# File 'lib/git-comitter/commit.rb', line 8 def match(commits) = commits.map{|c| @commit_property.call c} return .all? {|| @patterns.any?{ |pattern| =~ pattern } } end |