class Danger::Changelog::ChangelogHeaderLine
A CHANGELOG.md line represents the version header.
Constants
- CLOSE_PARENS
- HASHES
- ISO8601_DATE
- OPEN_PARENS
- SEMVER
Public Class Methods
validates_as_changelog_line?(line)
click to toggle source
# File lib/changelog/changelog_line/changelog_header_line.rb, line 22 def self.validates_as_changelog_line?(line) return true if line =~ /^#{HASHES}\s.+/ false end
Public Instance Methods
valid?()
click to toggle source
# File lib/changelog/changelog_line/changelog_header_line.rb, line 12 def valid? stripped_line = line.strip m = stripped_line.match(/^#{HASHES}\s#{OPEN_PARENS}[\w\s\:]*#{CLOSE_PARENS}$/) # title m ||= stripped_line.match(/^#{HASHES}\s#{OPEN_PARENS}#{SEMVER}#{CLOSE_PARENS}$/) # semver only m ||= stripped_line.match(/^#{HASHES}\s#{OPEN_PARENS}#{SEMVER}#{CLOSE_PARENS}[\s\-]+#{OPEN_PARENS}(#{ISO8601_DATE}|\w*)#{CLOSE_PARENS}$/) # semver and iso 8601 date or next version description !m.nil? && balanced?(stripped_line) end