lib/htmless/abstract.rb
def join(collection, glue = nil, &it)
      # TODO as helper? two block method call #join(collection, &item).with(&glue)
      glue_block = case glue
                     when String
                       lambda { text glue }
                     when Proc
                       glue
                     else
                       lambda {}
                   end

      collection.each_with_index do |obj, i|
        glue_block.call() if i > 0
        obj.is_a?(Proc) ? obj.call : it.call(obj)
      end
    end
def join(collection, glue = nil, &it)
      # TODO as helper? two block method call #join(collection, &item).with(&glue)
      glue_block = case glue
                     when String
                       lambda { text glue }
                     when Proc
                       glue
                     else
                       lambda {}
                   end

      collection.each_with_index do |obj, i|
        glue_block.call() if i > 0
        obj.is_a?(Proc) ? obj.call : it.call(obj)
      end
    end
joins and renders +collection+ with +glue+
 @param [Array<Proc, Object>] collection of objects or lambdas
 @param [Proc, String] glue can be String which is rendered with #text or block to render
 @yield how to render objects from +collection+, Proc in collection does not use this block
 @example
   join([1, 1.2], lambda { text ', ' }) {|o| text o }        # => "1, 1.2"
   join([1, 1.2], ', ') {|o| text o }                        # => "1, 1.2"
   join([->{ text 1 }, 1.2], ', ') {|o| text o }             # => "1, 1.2"