lib/changelog/parsers.rb in danger-changelog-0.5.0 vs lib/changelog/parsers.rb in danger-changelog-0.6.0

- old
+ new

@@ -3,17 +3,25 @@ require 'changelog/parsers/keep_a_changelog' module Danger module Changelog module Parsers - def self.default_format - :intridea - end + FORMATS = { intridea: IntrideaFormat, keep_a_changelog: KeepAChangelog }.freeze - def self.lookup(format) - { intridea: IntrideaFormat, keep_a_changelog: KeepAChangelog } - .fetch(format, IntrideaFormat) - .new + class << self + def default_format + :intridea + end + + def valid?(format) + FORMATS.keys.map(&:to_s).include?(format.to_s) + end + + def lookup(format) + FORMATS + .fetch(format, IntrideaFormat) + .new + end end end end end