module Corefines::String::Concat
@!method concat!(obj, separator = nil)
Appends (concatenates) the given object to _str_. If the _separator_ is set and this _str_ is not empty, then it appends the _separator_ before the _obj_. @example "".concat!("Greetings", ", ") # => "Greetings" "Greetings".concat!("programs!", ", ") #=> "Greetings, programs!" @param obj [String, Integer] the string, or codepoint to append. @param separator [String, nil] the separator to append when this _str_ is not empty. @return [String] self
Public Instance Methods
concat!(obj, separator = nil)
click to toggle source
# File lib/corefines/string.rb, line 163 def concat!(obj, separator = nil) if separator && !self.empty? self << separator << obj else self << obj end end