Module: BBCoder::Tag::ClassMethods

Included in:
BBCoder::Tag
Defined in:
lib/bbcoder/tag.rb

Instance Method Summary collapse

Instance Method Details

#reform(tag, meta, content = nil) ⇒ Object



40
41
42
43
44
45
46
# File 'lib/bbcoder/tag.rb', line 40

def reform(tag, meta, content = nil)
  if content.nil?
    %(#{reform_open(tag, meta)})
  else
    %(#{reform_open(tag, meta)}#{content}#{reform_end(tag)})
  end
end

#reform_end(tag) ⇒ Object



56
57
58
# File 'lib/bbcoder/tag.rb', line 56

def reform_end(tag)
  "[/#{tag}]"
end

#reform_open(tag, meta) ⇒ Object



48
49
50
51
52
53
54
# File 'lib/bbcoder/tag.rb', line 48

def reform_open(tag, meta)
  if meta.nil? || meta.empty?
    "[#{tag}]"
  else
    "[#{tag}=#{meta}]"
  end
end

#to_html(tag, meta, content) ⇒ Object



36
37
38
# File 'lib/bbcoder/tag.rb', line 36

def to_html(tag, meta, content)
  BBCoder.configuration[tag].to_html(meta, content)
end