class JSONFactory::Builder
Public Class Methods
new(template, local_variables = {})
click to toggle source
# File lib/json_factory/builder.rb, line 5 def initialize(template, local_variables = {}) @io = StringIO.new @template = template @local_variables = local_variables end
Public Instance Methods
build()
click to toggle source
# File lib/json_factory/builder.rb, line 15 def build json_builder = JSONBuilder.new(@io) if File.exist?(@template) json_builder.render_template(@template, @local_variables) else json_builder.render_string(@template, @local_variables) end @io.string end
context()
click to toggle source
# File lib/json_factory/builder.rb, line 11 def context @local_variables end