Class: D3C3Rails::Holder

Inherits:
Object
  • Object
show all
Includes:
Generators
Defined in:
lib/d3c3-rails/holder.rb

Overview

Content container

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Generators

#graph_generate, #graph_hide, #graph_load, #graph_perform, #graph_show, #graph_unload

Constructor Details

#initialize(args = {}) ⇒ Holder

Create new instance

Parameters:

  • args (Hash) (defaults to: {})

Options Hash (args):

  • :context (Context)


16
17
18
19
# File 'lib/d3c3-rails/holder.rb', line 16

def initialize(args={})
  @context = args[:context]
  @buffer = ''
end

Instance Attribute Details

#contextContext

Returns current context.

Returns:

  • (Context)

    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

Parameters:

  • string (String)

Returns:

  • (self)


25
26
27
28
# File 'lib/d3c3-rails/holder.rb', line 25

def << (string)
  @buffer << string.to_s
  self
end

#grapher_flushString

Clear current buffer and return content

Returns:

  • (String)


33
34
35
36
37
# File 'lib/d3c3-rails/holder.rb', line 33

def grapher_flush
  buf = @buffer.dup
  @buffer = ''
  buf
end