Sha256: ddd67551031628baf1d02b81cf6126be2126b54dc4c2b5b6c2b4b331f8b6c8fd
Contents?: true
Size: 644 Bytes
Versions: 5
Compression:
Stored size: 644 Bytes
Contents
class BBCoder attr_reader :raw def self.configure(&block) configuration.instance_eval(&block) end def self.configuration @configuration ||= BBCoder::Configuration.new end def initialize(text) @raw = text.split(/(\[[^\]]+\])/i).select {|string| string.size > 0} end def to_html @html ||= parse end def parse raw.each do |data| case data when /\[\/([^\]]+)\]/ buffer.tags.pop($1.to_sym) when /\[([^\]]+)\]/ buffer.tags.push($1) else buffer.push(data) end end buffer.join end def buffer @buffer ||= BBCoder::Buffer.new end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
bbcoder-0.1.4 | lib/bbcoder/base.rb |
bbcoder-0.1.3 | lib/bbcoder/base.rb |
bbcoder-0.1.2 | lib/bbcoder/base.rb |
bbcoder-0.1.1 | lib/bbcoder/base.rb |
bbcoder-0.1.0 | lib/bbcoder/base.rb |