Sha256: 1837bc1ed69d32b0e72442b3eea891e7b17638751dc2c17f9d400e6f7b2d78be
Contents?: true
Size: 520 Bytes
Versions: 47
Compression:
Stored size: 520 Bytes
Contents
# frozen_string_literal: true module Pragmater module Formatters # Formats shebang pragmas in a consistent manner. class Shebang PATTERN = %r(\A\#!\s?/.*ruby\Z) def initialize string, pattern: PATTERN @string = string @pattern = pattern end def call return string unless string.match? pattern string.split("!").then { |octothorpe, path| "#{octothorpe}! #{path.strip}" } end private attr_reader :string, :pattern end end end
Version data entries
47 entries across 47 versions & 1 rubygems