Sha256: 4d8a5e6a9ff6b900ee83a54831c4c9942fef551cde77afc6440abbe884f696bc
Contents?: true
Size: 639 Bytes
Versions: 41
Compression:
Stored size: 639 Bytes
Contents
# frozen_string_literal: true 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 } private attr_reader :string, :formatters end end end
Version data entries
41 entries across 41 versions & 1 rubygems