Module: SubDiff::CoreExt::String

Defined in:
lib/sub_diff/core_ext/string.rb

Instance Method Summary collapse

Instance Method Details

#gsub_diff(*args, &block) ⇒ Object

Behaves just like String#gsub but wraps the returned replacement string in an enumerable SubDiff::Collection of Diff objects.

See ruby-doc.org/core-2.2.0/String.html#method-i-gsub


16
17
18
# File 'lib/sub_diff/core_ext/string.rb', line 16

def gsub_diff(*args, &block)
  Builder.new(self, :gsub).diff(*args, &block)
end

#sub_diff(*args, &block) ⇒ Object

Behaves just like String#sub but wraps the returned replacement string in an enumerable SubDiff::Collection of Diff objects.

See ruby-doc.org/core-2.2.0/String.html#method-i-sub


8
9
10
# File 'lib/sub_diff/core_ext/string.rb', line 8

def sub_diff(*args, &block)
  Builder.new(self, :sub).diff(*args, &block)
end