Title: [waffle-scm] [807] trunk/waffle-ruby/src/main/java/org/codehaus/waffle/context/pico/RubyScriptLoader.java: More readable.
Revision
807
Author
mauro
Date
2008-09-03 08:26:21 -0500 (Wed, 03 Sep 2008)

Log Message

More readable.

Modified Paths


Diff

Modified: trunk/waffle-ruby/src/main/java/org/codehaus/waffle/context/pico/RubyScriptLoader.java (806 => 807)

--- trunk/waffle-ruby/src/main/java/org/codehaus/waffle/context/pico/RubyScriptLoader.java	2008-09-03 13:08:09 UTC (rev 806)
+++ trunk/waffle-ruby/src/main/java/org/codehaus/waffle/context/pico/RubyScriptLoader.java	2008-09-03 13:26:21 UTC (rev 807)
@@ -3,13 +3,13 @@
  */
 package org.codehaus.waffle.context.pico;
 
+import javax.servlet.ServletContext;
+
+import org.codehaus.waffle.Startable;
 import org.jruby.Ruby;
 import org.jruby.javasupport.JavaEmbedUtils;
 import org.jruby.runtime.builtin.IRubyObject;
-import org.codehaus.waffle.Startable;
 
-import javax.servlet.ServletContext;
-
 public class RubyScriptLoader implements Startable {
     public static final String RUBY_SCRIPT_PATH_KEY = "org.codehaus.waffle.ruby.path";
     public static final String DEFAULT_RUBY_SCRIPT_PATH = "/WEB-INF/classes/ruby/";
@@ -21,23 +21,23 @@
     public RubyScriptLoader(ServletContext servletContext, Ruby runtime) {
         this.servletContext = servletContext;
         this.runtime = runtime;
+        this.rubyScriptPath = getScriptPath(servletContext);
+    }
 
+    private String getScriptPath(ServletContext servletContext) {
         String path = servletContext.getInitParameter(RUBY_SCRIPT_PATH_KEY);
-        
-        if(path == null) {
-            rubyScriptPath = DEFAULT_RUBY_SCRIPT_PATH;
-        } else {
-            rubyScriptPath = path;
+        if (path == null) {
+            return DEFAULT_RUBY_SCRIPT_PATH;
         }
+        return path;
     }
 
     public void start() {
-        runtime.getClassFromPath("Waffle::ScriptLoader")
-                .callMethod(runtime.getCurrentContext(), "load_all",
-                        new IRubyObject[]{
-                                JavaEmbedUtils.javaToRuby(runtime, rubyScriptPath),
-                                JavaEmbedUtils.javaToRuby(runtime, servletContext)
-                        });
+        runtime.getClassFromPath("Waffle::ScriptLoader").callMethod(
+                runtime.getCurrentContext(),
+                "load_all",
+                new IRubyObject[] { JavaEmbedUtils.javaToRuby(runtime, rubyScriptPath),
+                        JavaEmbedUtils.javaToRuby(runtime, servletContext) });
     }
 
     public void stop() {


To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

Reply via email to