class Slacken::Rendering::RenderingGroup

Internal: an intermediate object to stringfy RenderElements.

Attributes

children[R]

Public Class Methods

new(children) click to toggle source
# File lib/slacken/rendering.rb, line 96
def initialize(children)
  @children = children
end

Public Instance Methods

separator() click to toggle source
# File lib/slacken/rendering.rb, line 100
def separator
  fail NotImplementedError
end
to_a() click to toggle source

Internal: Return Array of Strings, where there are separators between each string.

# File lib/slacken/rendering.rb, line 105
def to_a
  extracted_children = children.map { |c| c.respond_to?(:to_a) ? c.to_a : c }
  extracted_children.zip(Array.new(children.length, separator)).flatten[0..-2]
end
to_s() click to toggle source
# File lib/slacken/rendering.rb, line 110
def to_s
  to_a.reduce(StringWrapper.new('')) { |r, el| r.append(StringWrapper.wrap(el)) }.to_s
end