Class: GitReporting::MessageParser

Inherits:
Object
  • Object
show all
Defined in:
lib/git_reporting/message_parser.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(input) ⇒ MessageParser

Returns a new instance of MessageParser.



11
12
13
14
15
# File 'lib/git_reporting/message_parser.rb', line 11

def initialize(input)
  @input = input.to_s
  prefix = GitReporting.configuration.prefix
  @regexp = /\[\s*#{prefix && prefix + "\s*"}\s*(\d[^\[\]]*)\]/m
end

Instance Attribute Details

#inputObject (readonly)

Returns the value of attribute input.



5
6
7
# File 'lib/git_reporting/message_parser.rb', line 5

def input
  @input
end

#regexpObject (readonly)

Returns the value of attribute regexp.



5
6
7
# File 'lib/git_reporting/message_parser.rb', line 5

def regexp
  @regexp
end

Class Method Details

.parse(*args) ⇒ Object



7
8
9
# File 'lib/git_reporting/message_parser.rb', line 7

def self.parse(*args)
  new(*args).parse
end

Instance Method Details

#parseObject



17
18
19
20
21
# File 'lib/git_reporting/message_parser.rb', line 17

def parse
  message = parse_message
  time = parse_time
  [message, time]
end