Class: Hookers::Changelog::Parser
- Inherits:
-
Object
- Object
- Hookers::Changelog::Parser
- Defined in:
- lib/hookers/changelog/parser.rb
Constant Summary collapse
- MATCHERS =
[:service_now, :bugzilla, :pivotal_tracker]
Instance Attribute Summary collapse
-
#message ⇒ Object
Returns the value of attribute message.
-
#project ⇒ Object
Returns the value of attribute project.
Instance Method Summary collapse
- #get_matcher(name) ⇒ Object
-
#initialize(project) ⇒ Parser
constructor
A new instance of Parser.
- #parse(line) ⇒ Object
Constructor Details
#initialize(project) ⇒ Parser
Returns a new instance of Parser.
12 13 14 |
# File 'lib/hookers/changelog/parser.rb', line 12 def initialize(project) self.project = project end |
Instance Attribute Details
#message ⇒ Object
Returns the value of attribute message.
10 11 12 |
# File 'lib/hookers/changelog/parser.rb', line 10 def end |
#project ⇒ Object
Returns the value of attribute project.
10 11 12 |
# File 'lib/hookers/changelog/parser.rb', line 10 def project @project end |
Instance Method Details
#get_matcher(name) ⇒ Object
16 17 18 19 |
# File 'lib/hookers/changelog/parser.rb', line 16 def get_matcher(name) Hookers::Changelog::Matchers.const_get( "#{name.to_s.capitalize.gsub(/(_.)/) { |e| e[1].upcase }}Matcher") end |
#parse(line) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/hookers/changelog/parser.rb', line 21 def parse(line) id, = line.split(" ", 2) affects = [] commit = Commit.new(project, id, ) matchers = MATCHERS.each do |m| affects += get_matcher(m).scan(commit).map(&:to_affected) end affects end |