Module: D3C3Rails::Grapher

Defined in:
lib/d3c3-rails/grapher.rb

Overview

Loads graphing helper methods into class

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/d3c3-rails/grapher.rb', line 7

def self.included(base)
  D3C3Rails::Generators.instance_methods(false).each do |method|
    base.class_eval do

      def _grapher_holder
        @_grapher_holder ||= D3C3Rails::Holder.new
      end

      define_method method do |*args|
        _grapher_holder.context = self
        _grapher_holder.send(method, *args)
        _grapher_holder.grapher_flush.html_safe
      end

    end
  end

end