collection-renderer-lib/resources/collection_preview/bootstrap.rb
# Renders an ERB template against a hashmap of variables.
# Implements the normal Rails render method but makes it find resources on the classpath and delegates
# to the java_render function.
Renders an ERB template against a hashmap of variables.
Implements the normal Rails render method but makes it find resources on the classpath and delegates
to the java_render function.
Renders an ERB template against a hashmap of variables . Implements the normal Rails render method but makes it find resources on the classpath and delegates to the java_render function .
def render(args)
  begin
    if args.is_a? Hash
      partial_path = args[:partial]
      locals = args[:locals]
      if partial_path.respond_to? :call
        partial_path = partial_path()
      end
    else
      partial_path = args
      locals = {}
    end
    resource_path = partial_path_to_resource_path(partial_path)
    class_loader = Java::Java::lang::Thread.currentThread.getContextClassLoader
    input_stream = class_loader.getResourceAsStream(resource_path)
    java_render(input_stream, locals)
  rescue Exception => e
    puts e.message
    puts e.backtrace
    raise e
   end
end
def render ( args ) begin if args . is_a? Hash partial_path = args [ :partial ] locals = args [ :locals ] if partial_path . respond_to? :call partial_path = partial_path ( ) end else partial_path = args locals = { } end resource_path = partial_path_to_resource_path ( partial_path ) class_loader = Java :: Java :: lang :: Thread . currentThread . getContextClassLoader input_stream = class_loader . getResourceAsStream ( resource_path ) java_render ( input_stream , locals ) rescue Exception => e puts e . message puts e . backtrace raise e end end
Renders an ERB template against a hashmap of variables.
Renders an ERB template against a hashmap of variables .
# Uncomment this for debugging. # puts "Rendering #{resource_path} with #{locals.inspect}"
args
<not_specific>