class String
Public Instance Methods
append_until(content=" ") { |self| ... }
click to toggle source
Appends crap to the string until the given string satisfies the given condition
# File lib/functional_support/core_ext/string.rb, line 4 def append_until(content=" ", &condition) return self if yield self (self + content).append_until(content, &condition) end
consume(diet="")
click to toggle source
# File lib/functional_support/core_ext/string.rb, line 14 def consume(diet="") return self if diet.blank? or self.blank? if self[0] == diet[0] self[1..-1].consume diet[1..-1] else throw "Mismatched diet error #{diet} does not match #{self}" end end
prepend_until(content=" ") { |self| ... }
click to toggle source
# File lib/functional_support/core_ext/string.rb, line 9 def prepend_until(content=" ", &condition) return self if yield self (content + self).prepend_until(content, &condition) end