class Slacken::Rendering::DecorationWrapper
Internal: A string which should put distances from previous and next strings.
Public Instance Methods
append(other)
click to toggle source
Public: Append another string to self.
If the other string begin with a word character, A space is inserted between the two string.
# File lib/slacken/rendering.rb, line 51 def append(other) if other.to_s.empty? self elsif other.to_s.match(/\A[\W&&[:ascii:]]/) other.concat_head(self) else StringWrapper.new(to_s + " ").append(other) end end
concat_head(other)
click to toggle source
Private: Prepend another string to self.
If the other string end with a word character, A space is inserted between the two string.
# File lib/slacken/rendering.rb, line 64 def concat_head(other) if other.to_s.empty? self elsif other.to_s.match(/[\W&&[:ascii:]]\Z/) DecorationWrapper.new(other.to_s + to_s) else DecorationWrapper.new("#{other} #{to_s}") end end