Module: Corefines::String::Concat
- Defined in:
- lib/corefines/string.rb
Instance Method Summary collapse
-
#concat!(obj, separator = nil) ⇒ String
Appends (concatenates) the given object to str.
Instance Method Details
#concat!(obj, separator = nil) ⇒ String
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.
161 162 163 164 165 166 167 168 169 170 171 |
# File 'lib/corefines/string.rb', line 161 module Concat refine ::String do def concat!(obj, separator = nil) if separator && !self.empty? self << separator << obj else self << obj end end end end |