lib/pragmater/formatters/main.rb in pragmater-9.3.0 vs lib/pragmater/formatters/main.rb in pragmater-10.0.0
- old
+ new
@@ -3,21 +3,20 @@
module Pragmater
module Formatters
# Formats all pragmas in a consistent manner.
class Main
FORMATTERS = [General, Shebang].freeze
+
PATTERN = FORMATTERS.map { |formatter| formatter::PATTERN }
.then { |patterns| Regexp.union(*patterns) }
.freeze
def initialize string, formatters: FORMATTERS
@string = string
@formatters = formatters
end
- def call
- formatters.reduce(string) { |pragma, formatter| formatter.new(pragma).call }
- end
+ def call = formatters.reduce(string) { |pragma, formatter| formatter.new(pragma).call }
private
attr_reader :string, :formatters
end