Class: RuBBCoder::Tag
- Inherits:
-
Object
- Object
- RuBBCoder::Tag
- Defined in:
- lib/rubbcoder.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#coder ⇒ Object
Returns the value of attribute coder.
Class Method Summary collapse
Instance Method Summary collapse
- #encode(contents, attribute) ⇒ Object
-
#initialize(text, opts = {}, &blk) ⇒ Tag
constructor
A new instance of Tag.
Constructor Details
#initialize(text, opts = {}, &blk) ⇒ Tag
Returns a new instance of Tag.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/rubbcoder.rb', line 8 def initialize(text, opts = {}, &blk) @coder = nil @text = text @example = opts[:example] @decription = opts[:description] @block = opts[:block] @block = true if @block.nil? @front = opts[:front] @back = opts[:back] if @block @custom = blk end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
6 7 8 |
# File 'lib/rubbcoder.rb', line 6 def block @block end |
#coder ⇒ Object
Returns the value of attribute coder.
5 6 7 |
# File 'lib/rubbcoder.rb', line 5 def coder @coder end |
Class Method Details
.clean_css(css) ⇒ Object
32 33 34 35 |
# File 'lib/rubbcoder.rb', line 32 def self.clean_css(css) css = css.split(";").first return css.split("\"").first end |
Instance Method Details
#encode(contents, attribute) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/rubbcoder.rb', line 20 def encode(contents, attribute) attribute.gsub!(/^=/, "") if attribute attribute = "" if attribute.nil? if @custom return @custom.call(contents, attribute, @coder.) elsif @block return "#{@front}#{contents}#{@back}" else return @front end end |