Sha256: a6c8892259153132e87a5510f54b9bd2346da2b66044f1481f308aea8880044a
Contents?: true
Size: 642 Bytes
Versions: 96
Compression:
Stored size: 642 Bytes
Contents
# frozen_string_literal: true require 'eac_ruby_utils/core_ext' module Avm module Files class TextReplacer require_sub __FILE__ enable_immutable immutable_accessor :replacement, type: :array def apply(input) replacements.inject(input) { |a, e| e.apply(a) } end def file_apply(file) file = file.to_pathname input = file.read output = apply(file.read) return false if output == input file.write(output) true end def gsub(from, to) replacement(::Avm::Files::TextReplacer::Gsub.new(from, to)) end end end end
Version data entries
96 entries across 96 versions & 2 rubygems