@Override public boolean remove(RubyHash hash, Object o) { return hash.remove(o) != null; } };
@Override public boolean remove(RubyHash hash, Object o) { return hash.remove(o) != null; } };
public boolean remove(RubyHash hash, Object o) { return hash.remove(o) != null; } };
public boolean remove(RubyHash hash, Object o) { return hash.remove(o) != null; } };
public void visit(IRubyObject key, IRubyObject value) { if (!block.yieldSpecific(context, key, value).isTrue()) { modified[0] = true; remove(key); } } });
public void visit(IRubyObject key, IRubyObject value) { if (!block.yieldSpecific(context, key, value).isTrue()) { modified[0] = true; remove(key); } } });
@Override public Object remove(Object key) { if (!(key instanceof String)) { return null; } Object convertedKey = convertJavaToRubyKey((String) key); Object oldValue = rubyHash.get(convertedKey); rubyHash.remove(convertedKey); return convertRubyValue(oldValue); }
@Inject public RackServlet(RackServletConfig config) throws IOException { Preconditions.checkNotNull(config); File rackScriptFile = new File(config.getRackConfigPath()); Preconditions.checkArgument(rackScriptFile.canRead(), "Could not find rack script specified by [" + config.getRackConfigPath() + "] and resolved to [" + rackScriptFile.getAbsolutePath() + "]"); runtime = JavaEmbedUtils.initialize(ImmutableList.of(rackScriptFile.getParentFile().getCanonicalPath()), createRuntimeConfig()); // don't inherit system settings for gems RubyHash env = runtime.evalScriptlet("ENV").convertToHash(); env.remove("GEM_HOME"); env.remove("GEM_PATH"); InputStream stream = Resources.getResource("io/airlift/rack.rb").openStream(); try { runtime.loadFile("rack.rb", stream, false); } finally { stream.close(); } IRubyObject builder = runtime.evalScriptlet("Airlift::RackServer::Builder.new"); rackApplication = adapter.callMethod(builder, "build", new IRubyObject[] { javaToRuby(runtime, rackScriptFile.getCanonicalPath()) }); }
@Override public void visit(ThreadContext context, RubyHash self, IRubyObject key, IRubyObject value, int index, Block block) { if (!block.yieldArray(context, context.runtime.newArray(key, value), null).isTrue()) { modified = true; self.remove(key); } } }
@Override public Object remove(Object key) { if (!(key instanceof String)) { return null; } Object convertedKey = convertJavaToRubyKey((String) key); Object oldValue = rubyHash.get(convertedKey); rubyHash.remove(convertedKey); return convertRubyValue(oldValue); }
@Inject public RackServlet(RackServletConfig config) throws IOException { Preconditions.checkNotNull(config); File rackScriptFile = new File(config.getRackConfigPath()); Preconditions.checkArgument(rackScriptFile.canRead(), "Could not find rack script specified by [" + config.getRackConfigPath() + "] and resolved to [" + rackScriptFile.getAbsolutePath() + "]"); runtime = JavaEmbedUtils.initialize(ImmutableList.of(rackScriptFile.getParentFile().getCanonicalPath()), createRuntimeConfig()); // don't inherit system settings for gems RubyHash env = runtime.evalScriptlet("ENV").convertToHash(); env.remove("GEM_HOME"); env.remove("GEM_PATH"); InputStream stream = Resources.getResource("proofpoint/rack.rb").openStream(); try { runtime.loadFile("rack.rb", stream, false); } finally { stream.close(); } IRubyObject builder = runtime.evalScriptlet("Proofpoint::RackServer::Builder.new"); rackApplication = adapter.callMethod(builder, "build", new IRubyObject[] { javaToRuby(runtime, rackScriptFile.getCanonicalPath()) }); }
@Override public void visit(ThreadContext context, RubyHash self, IRubyObject key, IRubyObject value, int index, Block block) { if (!block.yieldArray(context, context.runtime.newArray(key, value), null).isTrue()) { modified = true; self.remove(key); } } }
@Inject public RackServlet(RackServletConfig config) throws IOException { Preconditions.checkNotNull(config); File rackScriptFile = new File(config.getRackConfigPath()); Preconditions.checkArgument(rackScriptFile.canRead(), "Could not find rack script specified by [" + config.getRackConfigPath() + "] and resolved to [" + rackScriptFile.getAbsolutePath() + "]"); runtime = JavaEmbedUtils.initialize(ImmutableList.of(rackScriptFile.getParentFile().getCanonicalPath()), createRuntimeConfig()); // don't inherit system settings for gems RubyHash env = runtime.evalScriptlet("ENV").convertToHash(); env.remove("GEM_HOME"); env.remove("GEM_PATH"); InputStream stream = Resources.getResource("io/airlift/rack.rb").openStream(); try { runtime.loadFile("rack.rb", stream, false); } finally { stream.close(); } IRubyObject builder = runtime.evalScriptlet("Airlift::RackServer::Builder.new"); rackApplication = adapter.callMethod(builder, "build", new IRubyObject[] { javaToRuby(runtime, rackScriptFile.getCanonicalPath()) }); }
@Override public Object remove(Object key) { if (!(key instanceof String)) { return null; } Object oldValue = get(key); RubySymbol symbol = rubyHash.getRuntime().getSymbolTable().getSymbol((String) key); rubyHash.remove(symbol); return convertRubyValue(oldValue); }
@Override public Object remove(Object key) { if (!(key instanceof String)) { return null; } Object oldValue = get(key); RubySymbol symbol = rubyHash.getRuntime().getSymbolTable().getSymbol((String) key); rubyHash.remove(symbol); return convertRubyValue(oldValue); }