lib/permalink.rb in permalink-2.1.0 vs lib/permalink.rb in permalink-3.0.0

- old
+ new

@@ -17,22 +17,34 @@ Normalizations::NonAlphanumeric, Normalizations::MultipleDashes, Normalizations::LeadingTrailingDashes ].freeze + DEFAULT_SEPARATOR = "-" + DEFAULT_OPTIONS = { normalizations: DEFAULT_NORMALIZATIONS, - separator: "-" + separator: DEFAULT_SEPARATOR }.freeze - def self.generate(input, options = DEFAULT_OPTIONS) - options = DEFAULT_OPTIONS.merge(options) + def self.active_record + ActiveRecord + end + def self.call( + input, + normalizations: DEFAULT_NORMALIZATIONS, + separator: DEFAULT_SEPARATOR + ) + options = DEFAULT_OPTIONS.merge(normalizations:, separator:) + options[:normalizations].each do |normalization| input = normalization.call(input, options) end input end -end -ActiveRecord::Base.include Permalink::ActiveRecord + class << self + alias generate call + end +end