class ChangelogFilter
Filters a text or array for changelog entries.
Attributes
changelog[RW]
An array of changelog entries.
other_text[RW]
An array of text lines that are not changelog entries.
Public Class Methods
FromArray(ary)
click to toggle source
Factory method that creates an instance given an array of strings
# File lib/changelog_filter.rb, line 28 def self.FromArray(ary) unless ary.is_a?(Array) fail "Must call this factory with Array, not " + ary.class.to_s end filter = ChangelogFilter.new log, text = ary.partition do |line| line.match(pattern) end filter.changelog = log.uniq.sort.remove_indent if log.length > 0 filter.other_text = text if text.length > 0 filter end
FromString(string)
click to toggle source
Factory method that creates an instance given a text string
# File lib/changelog_filter.rb, line 20 def self.FromString(string) unless string.is_a?(String) fail "Must call this factory with String, not " + string.class.to_s end self.FromArray(string.chomp.split("\n")) end
new()
click to toggle source
# File lib/changelog_filter.rb, line 54 def initialize end
pattern()
click to toggle source
Returns the grep string that matches changelog entries.
# File lib/changelog_filter.rb, line 42 def self.pattern '\s*[*-]\s+[^:]+:\s' end