Class: BBCoder::Buffer
- Inherits:
-
Object
- Object
- BBCoder::Buffer
- Defined in:
- lib/bbcoder/buffer.rb
Instance Attribute Summary collapse
-
#_internal ⇒ Object
Returns the value of attribute _internal.
-
#tags ⇒ Object
Returns the value of attribute tags.
Instance Method Summary collapse
-
#depth ⇒ Object
delegates to tags.
-
#initialize ⇒ Buffer
constructor
A new instance of Buffer.
-
#join ⇒ Object
end of processing, insert any orphaned tags without conversion.
- #pop(depth_modifier = 0) ⇒ Object
- #push(content) ⇒ Object
Constructor Details
#initialize ⇒ Buffer
Returns a new instance of Buffer.
5 6 7 8 |
# File 'lib/bbcoder/buffer.rb', line 5 def initialize @_internal = {} @tags = BBCoder::BufferTags.new(self) end |
Instance Attribute Details
#_internal ⇒ Object
Returns the value of attribute _internal.
3 4 5 |
# File 'lib/bbcoder/buffer.rb', line 3 def _internal @_internal end |
#tags ⇒ Object
Returns the value of attribute tags.
3 4 5 |
# File 'lib/bbcoder/buffer.rb', line 3 def @tags end |
Instance Method Details
#depth ⇒ Object
delegates to tags
25 26 27 |
# File 'lib/bbcoder/buffer.rb', line 25 def depth .size end |
#join ⇒ Object
end of processing, insert any orphaned tags without conversion
20 21 22 |
# File 'lib/bbcoder/buffer.rb', line 20 def join push(.join) end |
#pop(depth_modifier = 0) ⇒ Object
15 16 17 |
# File 'lib/bbcoder/buffer.rb', line 15 def pop(depth_modifier = 0) _internal.delete(depth + depth_modifier) end |
#push(content) ⇒ Object
10 11 12 13 |
# File 'lib/bbcoder/buffer.rb', line 10 def push(content) _internal[depth] ||= "" _internal[depth] += content end |