Class: D3C3Rails::Holder
- Inherits:
-
Object
- Object
- D3C3Rails::Holder
- Includes:
- Generators
- Defined in:
- lib/d3c3-rails/holder.rb
Overview
Content container
Instance Attribute Summary collapse
-
#context ⇒ Context
Current context.
Instance Method Summary collapse
-
#<<(string) ⇒ self
Add string to buffer.
-
#grapher_flush ⇒ String
Clear current buffer and return content.
-
#initialize(args = {}) ⇒ Holder
constructor
Create new instance.
Methods included from Generators
#graph_generate, #graph_hide, #graph_load, #graph_perform, #graph_show, #graph_unload
Constructor Details
#initialize(args = {}) ⇒ Holder
Create new instance
16 17 18 19 |
# File 'lib/d3c3-rails/holder.rb', line 16 def initialize(args={}) @context = args[:context] @buffer = '' end |
Instance Attribute Details
#context ⇒ Context
Returns current context.
10 11 12 |
# File 'lib/d3c3-rails/holder.rb', line 10 def context @context end |
Instance Method Details
#<<(string) ⇒ self
Add string to buffer
25 26 27 28 |
# File 'lib/d3c3-rails/holder.rb', line 25 def << (string) @buffer << string.to_s self end |
#grapher_flush ⇒ String
Clear current buffer and return content
33 34 35 36 37 |
# File 'lib/d3c3-rails/holder.rb', line 33 def grapher_flush buf = @buffer.dup @buffer = '' buf end |