Sha256: 2487a1e1f9b99d23235c4ce3b6944c5f70193bb0efcf22e876cccdfe2191db6c

Contents?: true

Size: 529 Bytes

Versions: 12

Compression:

Stored size: 529 Bytes

Contents

class BBCoder
  class Buffer
    attr_accessor :_internal, :tags

    def initialize
      @_internal = {}
      @tags = BBCoder::BufferTags.new(self)
    end

    def push(content)
      _internal[depth] ||= ""
      _internal[depth] += content
    end

    def pop(depth_modifier = 0)
      _internal.delete(depth + depth_modifier)
    end

    # end of processing, insert any orphaned tags without conversion
    def join
      push(tags.join)
    end

    # delegates to tags
    def depth
      tags.size
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
bbcoder-1.1.1 lib/bbcoder/buffer.rb
bbcoder-1.1.0 lib/bbcoder/buffer.rb
bbcoder-1.0.1 lib/bbcoder/buffer.rb
bbcoder-1.0.0 lib/bbcoder/buffer.rb
bbcoder-0.2.0 lib/bbcoder/buffer.rb
bbcoder-0.1.6 lib/bbcoder/buffer.rb
bbcoder-0.1.5 lib/bbcoder/buffer.rb
bbcoder-0.1.4 lib/bbcoder/buffer.rb
bbcoder-0.1.3 lib/bbcoder/buffer.rb
bbcoder-0.1.2 lib/bbcoder/buffer.rb
bbcoder-0.1.1 lib/bbcoder/buffer.rb
bbcoder-0.1.0 lib/bbcoder/buffer.rb