lib/bbcoder/base.rb in bbcoder-1.0.1 vs lib/bbcoder/base.rb in bbcoder-1.1.0
- old
+ new
@@ -16,24 +16,26 @@
def to_html
@html ||= parse
end
def parse
+ _parse
+ buffer.join
+ end
+
+ def buffer
+ @buffer ||= BBCoder::Buffer.new
+ end
+
+ def _parse
raw.each do |data|
case data
when /\[\/([^\]]+)\]/
buffer.tags.pop($1) # popping end tag
when /\[([^\]]+)\]/
buffer.tags.push($1) # pushing start tag
else
buffer.push(data) # content
end
end
-
- buffer.join
- end
-
- def buffer
- @buffer ||= BBCoder::Buffer.new
- end
+ end # _parse
end
-