Class: Hookers::Changelog::Matchers::Matcher
- Inherits:
-
Object
- Object
- Hookers::Changelog::Matchers::Matcher
show all
- Defined in:
- lib/hookers/changelog/matchers.rb
Constant Summary
collapse
- SUBPATTERN =
/(?:\s+\#\s*(\d+))/
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(commit, type, number) ⇒ Matcher
Returns a new instance of Matcher.
18
19
20
21
22
|
# File 'lib/hookers/changelog/matchers.rb', line 18
def initialize(commit, type, number)
self.commit = commit
self.type = type
self.number = number
end
|
Instance Attribute Details
#commit ⇒ Object
Returns the value of attribute commit.
7
8
9
|
# File 'lib/hookers/changelog/matchers.rb', line 7
def commit
@commit
end
|
#number ⇒ Object
Returns the value of attribute number.
7
8
9
|
# File 'lib/hookers/changelog/matchers.rb', line 7
def number
@number
end
|
#type ⇒ Object
Returns the value of attribute type.
7
8
9
|
# File 'lib/hookers/changelog/matchers.rb', line 7
def type
@type
end
|
Class Method Details
.blocks_of(commit, regexp, subpattern = nil) ⇒ Object
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/hookers/changelog/matchers.rb', line 36
def self.blocks_of(commit, regexp, subpattern = nil)
results = []
commit.message.scan(/(\[(?:#{regexp}\s*)+\])/i).each do |e|
if subpattern
results += e[2].scan(subpattern).map { |sub| [e[1], sub[0]] }
else
results << e.slice(1..2)
end
end
results
end
|
.scan(commit) ⇒ Object
10
11
12
|
# File 'lib/hookers/changelog/matchers.rb', line 10
def self.scan(commit)
[]
end
|
Instance Method Details
#identifier ⇒ Object
14
15
16
|
# File 'lib/hookers/changelog/matchers.rb', line 14
def identifier
"#{type} ##{number}"
end
|
#to_affected ⇒ Object
32
33
34
|
# File 'lib/hookers/changelog/matchers.rb', line 32
def to_affected
Hookers::Changelog::Affects.new(commit, type, number, uri, identifier)
end
|
#uri ⇒ Object
24
25
26
|
# File 'lib/hookers/changelog/matchers.rb', line 24
def uri
nil
end
|