class Hookers::Changelog::Parser

Constants

MATCHERS

Attributes

message[RW]
project[RW]

Public Class Methods

new(project) click to toggle source
# File lib/hookers/changelog/parser.rb, line 12
def initialize(project)
  self.project = project
end

Public Instance Methods

get_matcher(name) click to toggle source
# 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) click to toggle source
# File lib/hookers/changelog/parser.rb, line 21
def parse(line)
  id, message = line.split(" ", 2)
  affects = []
  commit = Commit.new(project, id, message)

  matchers = MATCHERS.each do |m|
    affects += get_matcher(m).scan(commit).map(&:to_affected)
  end

  affects
end