Sha256: 26d5adb780dd768dbb96668cb2e42c517a1a4471361b5919ca8837aeea790b85

Contents?: true

Size: 684 Bytes

Versions: 2

Compression:

Stored size: 684 Bytes

Contents

require 'd3c3-rails'

module D3C3Rails
  # Content container
  class Holder

    include D3C3Rails::Generators

    # @return [Context] current context
    attr_accessor :context

    # Create new instance
    #
    # @param args [Hash]
    # @option args [Context] :context
    def initialize(args={})
      @context = args[:context]
      @buffer = ''
    end

    # Add string to buffer
    #
    # @param string [String]
    # @return [self]
    def << (string)
      @buffer << string.to_s
      self
    end

    # Clear current buffer and return content
    #
    # @return [String]
    def grapher_flush
      buf = @buffer.dup
      @buffer = ''
      buf
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
d3c3-rails-0.1.2 lib/d3c3-rails/holder.rb
d3c3-rails-0.1.0 lib/d3c3-rails/holder.rb