Class: MGit::GitMessageParser
- Inherits:
-
Object
- Object
- MGit::GitMessageParser
- Defined in:
- lib/m-git/foundation/git_message_parser.rb
Overview
Git interact message parse with git-server
Instance Method Summary collapse
- #__default_parse_msg(msg) ⇒ Object
-
#initialize(url) ⇒ GitMessageParser
constructor
A new instance of GitMessageParser.
-
#parse_code_review_url(input) ⇒ String
默认无解析.
- #parse_fetch_msg(input) ⇒ String?
- #parse_pull_msg(input) ⇒ String?
- #parse_push_msg(input) ⇒ String?
Constructor Details
#initialize(url) ⇒ GitMessageParser
Returns a new instance of GitMessageParser.
7 8 9 |
# File 'lib/m-git/foundation/git_message_parser.rb', line 7 def initialize(url) @url = url end |
Instance Method Details
#__default_parse_msg(msg) ⇒ Object
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/m-git/foundation/git_message_parser.rb', line 38 def __default_parse_msg(msg) return if msg.nil? || msg.empty? key_word = 'error:' error_line = msg.split("\n").find {|line| # 解析 "error: failed to push some refs..." line.include?(key_word) } msg if error_line end |
#parse_code_review_url(input) ⇒ String
默认无解析
34 35 36 |
# File 'lib/m-git/foundation/git_message_parser.rb', line 34 def parse_code_review_url(input) nil end |
#parse_fetch_msg(input) ⇒ String?
14 15 16 |
# File 'lib/m-git/foundation/git_message_parser.rb', line 14 def parse_fetch_msg(input) parse_pull_msg(input) end |
#parse_pull_msg(input) ⇒ String?
21 22 23 |
# File 'lib/m-git/foundation/git_message_parser.rb', line 21 def parse_pull_msg(input) __default_parse_msg(input) end |
#parse_push_msg(input) ⇒ String?
28 29 30 |
# File 'lib/m-git/foundation/git_message_parser.rb', line 28 def parse_push_msg(input) __default_parse_msg(input) end |