Module: Tokamak::Builder

Defined in:
lib/tokamak/builder.rb,
lib/tokamak/builder/xml.rb,
lib/tokamak/builder/base.rb,
lib/tokamak/builder/json.rb,
lib/tokamak/builder/values.rb

Defined Under Namespace

Classes: Base, Json, Values, Xml

Class Method Summary collapse

Class Method Details

.helper_module_for(const) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/tokamak/builder.rb', line 8

def self.helper_module_for(const)
  mod = Module.new
  mod.module_eval <<-EOS
    def collection(obj, *args, &block)
      #{const.name}.build(obj, *args, &block)
    end

    alias_method :member, :collection
  EOS
  mod
end