s/blk/block
This commit is contained in:
parent
880362669b
commit
2b29c498fa
@ -2559,11 +2559,11 @@ class Formula
|
|||||||
before: T.nilable(T.any(Pathname, Regexp, String)),
|
before: T.nilable(T.any(Pathname, Regexp, String)),
|
||||||
after: T.nilable(T.any(Pathname, String, Symbol)),
|
after: T.nilable(T.any(Pathname, String, Symbol)),
|
||||||
audit_result: T::Boolean,
|
audit_result: T::Boolean,
|
||||||
blk: T.nilable(T.proc.params(s: StringInreplaceExtension).void),
|
block: T.nilable(T.proc.params(s: StringInreplaceExtension).void),
|
||||||
).void
|
).void
|
||||||
}
|
}
|
||||||
def inreplace(paths, before = nil, after = nil, audit_result = true, &blk) # rubocop:disable Style/OptionalBooleanParameter
|
def inreplace(paths, before = nil, after = nil, audit_result = true, &block) # rubocop:disable Style/OptionalBooleanParameter
|
||||||
Utils::Inreplace.inreplace(paths, before, after, audit_result: audit_result, &blk)
|
Utils::Inreplace.inreplace(paths, before, after, audit_result: audit_result, &block)
|
||||||
rescue Utils::Inreplace::Error => e
|
rescue Utils::Inreplace::Error => e
|
||||||
onoe e.to_s
|
onoe e.to_s
|
||||||
raise BuildError.new(self, "inreplace", Array(paths), {})
|
raise BuildError.new(self, "inreplace", Array(paths), {})
|
||||||
|
@ -41,10 +41,10 @@ module Utils
|
|||||||
before: T.nilable(T.any(Pathname, Regexp, String)),
|
before: T.nilable(T.any(Pathname, Regexp, String)),
|
||||||
after: T.nilable(T.any(Pathname, String, Symbol)),
|
after: T.nilable(T.any(Pathname, String, Symbol)),
|
||||||
audit_result: T::Boolean,
|
audit_result: T::Boolean,
|
||||||
blk: T.nilable(T.proc.params(s: StringInreplaceExtension).void),
|
block: T.nilable(T.proc.params(s: StringInreplaceExtension).void),
|
||||||
).void
|
).void
|
||||||
}
|
}
|
||||||
def self.inreplace(paths, before = nil, after = nil, audit_result: true, &blk)
|
def self.inreplace(paths, before = nil, after = nil, audit_result: true, &block)
|
||||||
paths = Array(paths)
|
paths = Array(paths)
|
||||||
after &&= after.to_s
|
after &&= after.to_s
|
||||||
before = before.to_s if before.is_a?(Pathname)
|
before = before.to_s if before.is_a?(Pathname)
|
||||||
@ -58,7 +58,7 @@ module Utils
|
|||||||
s = StringInreplaceExtension.new(str)
|
s = StringInreplaceExtension.new(str)
|
||||||
|
|
||||||
if before.nil? && after.nil?
|
if before.nil? && after.nil?
|
||||||
raise ArgumentError, "Must supply a block or before/after params" unless blk
|
raise ArgumentError, "Must supply a block or before/after params" unless block
|
||||||
|
|
||||||
yield s
|
yield s
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user