Skip to content

Commit

Permalink
remove unused method ReplaceWith
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Feb 4, 2015
1 parent 44fc32f commit a2f5ac7
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 35 deletions.
15 changes: 0 additions & 15 deletions library/types/src/modules/String.rb
Expand Up @@ -1016,20 +1016,6 @@ def FindMountPoint(dir, dirs)
dir
end

# Replaces all characters in a given string with some other string or character
#
# @param (string) input string
# @param (string) all characters to replace
# @param (string) replace with
# @param (string) string with replaced characters
#
# @example
# // Replace whitespace characters with dashes
# ReplaceWith ("a\nb\tc d", "\n\t ", "-") -> "a-b-c-d"
def ReplaceWith(str, chars, glue)
Builtins.mergestring(Builtins.splitstring(str, chars), glue)
end

publish function: :Quote, type: "string (string)"
publish function: :UnQuote, type: "string (string)"
publish function: :OptParens, type: "string (string)"
Expand Down Expand Up @@ -1065,7 +1051,6 @@ def ReplaceWith(str, chars, glue)
publish function: :RemoveShortcut, type: "string (string)"
publish function: :StartsWith, type: "boolean (string, string)"
publish function: :FindMountPoint, type: "string (string, list <string>)"
publish function: :ReplaceWith, type: "string (string, string, string)"

private

Expand Down
20 changes: 0 additions & 20 deletions library/types/test/string_test.rb
Expand Up @@ -343,26 +343,6 @@
end
end

describe ".ReplaceWith" do
it "returns string with all characters in chars replaced by glue" do
expect(subject.ReplaceWith("a\nb\tc d", "\n\t ", "-")).to eq "a-b-c-d"
expect(subject.ReplaceWith("a\nb\tc d", "\n\t ", "")).to eq "abcd"
end

it "returns nil if str is nil" do
expect(subject.ReplaceWith(nil, " ", "")).to eq nil
end

it "returns nil if chars is nil" do
expect(subject.ReplaceWith("abc", nil, "")).to eq nil
end

it "returns nil if glue is nil" do
expect(subject.ReplaceWith("abc", "a", nil)).to eq nil
expect(subject.ReplaceWith("abc", "d", nil)).to eq nil
end
end

describe ".OptParens" do
it "returns parameter in parens and with space prefix" do
expect(subject.OptParens(5)).to eq " (5)"
Expand Down

0 comments on commit a2f5ac7

Please sign in to comment.