Class: StructuredChangelog::Release
- Inherits:
-
Object
- Object
- StructuredChangelog::Release
- Defined in:
- lib/structured_changelog/release.rb
Instance Attribute Summary collapse
-
#contents ⇒ Object
readonly
Returns the value of attribute contents.
Class Method Summary collapse
Instance Method Summary collapse
- #<=>(release) ⇒ Object
-
#initialize(contents) ⇒ Release
constructor
A new instance of Release.
- #validate ⇒ Object
- #version ⇒ Object
Constructor Details
#initialize(contents) ⇒ Release
Returns a new instance of Release.
15 16 17 |
# File 'lib/structured_changelog/release.rb', line 15 def initialize(contents) @contents = contents.strip end |
Instance Attribute Details
#contents ⇒ Object (readonly)
Returns the value of attribute contents.
5 6 7 |
# File 'lib/structured_changelog/release.rb', line 5 def contents @contents end |
Class Method Details
.pattern ⇒ Object
11 12 13 |
# File 'lib/structured_changelog/release.rb', line 11 def self.pattern /^## RELEASE #{VersionPattern}$/ end |
.start_with?(line) ⇒ Boolean
7 8 9 |
# File 'lib/structured_changelog/release.rb', line 7 def self.start_with?(line) line =~ pattern end |
Instance Method Details
#<=>(release) ⇒ Object
33 34 35 |
# File 'lib/structured_changelog/release.rb', line 33 def <=>(release) version <=> release.version end |
#validate ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/structured_changelog/release.rb', line 19 def validate notifications = [] notifications << "No version number" if version.nil? notifications end |
#version ⇒ Object
27 28 29 30 31 |
# File 'lib/structured_changelog/release.rb', line 27 def version version_string = contents.match(self.class.pattern)[:version] Gem::Version.new(version_string) end |