Class: PimpMyChangelog::Parser
- Inherits:
-
Object
- Object
- PimpMyChangelog::Parser
- Defined in:
- lib/pimpmychangelog/parser.rb
Instance Attribute Summary collapse
-
#changelog ⇒ Object
readonly
Returns the value of attribute changelog.
Instance Method Summary collapse
-
#content ⇒ String
The changelog content without the link definitions.
-
#contributors ⇒ Array
Ordered array of contributors found in the changelog Example: [‘gregbell’, ‘pcreux’, ‘samvincent’].
-
#initialize(changelog) ⇒ Parser
constructor
A new instance of Parser.
-
#issues ⇒ Array
Ordered array of issue numbers found in the changelog Example: [‘12’, ‘223’, ‘470’].
Constructor Details
#initialize(changelog) ⇒ Parser
Returns a new instance of Parser.
6 7 8 |
# File 'lib/pimpmychangelog/parser.rb', line 6 def initialize(changelog) @changelog = changelog end |
Instance Attribute Details
#changelog ⇒ Object (readonly)
Returns the value of attribute changelog.
3 4 5 |
# File 'lib/pimpmychangelog/parser.rb', line 3 def changelog @changelog end |
Instance Method Details
#content ⇒ String
Returns 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 |
#contributors ⇒ Array
Returns 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 |
#issues ⇒ Array
Returns 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 |