Class: PimpMyChangelog::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/pimpmychangelog/parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(changelog) ⇒ Parser

Returns a new instance of Parser.

Parameters:

  • changelog (String)


6
7
8
# File 'lib/pimpmychangelog/parser.rb', line 6

def initialize(changelog)
  @changelog = changelog
end

Instance Attribute Details

#changelogObject (readonly)

Returns the value of attribute changelog.



3
4
5
# File 'lib/pimpmychangelog/parser.rb', line 3

def changelog
  @changelog
end

Instance Method Details

#contentString

Returns the changelog content without the link definitions.

Returns:

  • (String)

    the changelog content without the link definitions



11
12
13
# File 'lib/pimpmychangelog/parser.rb', line 11

def content
  @changelog.split(Pimper::SEPARATOR).first
end

#contributorsArray

Returns ordered array of contributors found in the changelog Example: [‘gregbell’, ‘pcreux’, ‘samvincent’].

Returns:

  • (Array)

    ordered array of contributors found in the changelog Example: [‘gregbell’, ‘pcreux’, ‘samvincent’]



23
24
25
# File 'lib/pimpmychangelog/parser.rb', line 23

def contributors
  changelog.scan(/@([\w-]+)/).flatten.uniq.sort
end

#issuesArray

Returns ordered array of issue numbers found in the changelog Example: [‘12’, ‘223’, ‘470’].

Returns:

  • (Array)

    ordered array of issue numbers found in the changelog Example: [‘12’, ‘223’, ‘470’]



17
18
19
# File 'lib/pimpmychangelog/parser.rb', line 17

def issues
  changelog.scan(/#(\d+)/).flatten.uniq.sort_by(&:to_i)
end