private RubyHashMap getOrCreateRubyHashMap() { if (wrappedMap == null) { wrappedMap = new RubyHashMap(getRuntime(), this); } // (JavaProxy)recv).getObject() might raise exception when // wrong number of args are given to the constructor. IRubyObject oldExc = getRuntime().getGlobalVariables().get("$!"); // Save $! try { wrappedMap.setSize( getMapObject().size() ); } catch (RaiseException e) { wrappedMap.setSize(0); getRuntime().getGlobalVariables().set("$!", oldExc); // Restore $! } return wrappedMap; }
private RubyHashMap getOrCreateRubyHashMap() { if (wrappedMap == null) { wrappedMap = new RubyHashMap(getRuntime(), this); } // (JavaProxy)recv).getObject() might raise exception when // wrong number of args are given to the constructor. IRubyObject oldExc = getRuntime().getGlobalVariables().get("$!"); // Save $! try { wrappedMap.setSize( getMapObject().size() ); } catch (RaiseException e) { wrappedMap.setSize(0); getRuntime().getGlobalVariables().set("$!", oldExc); // Restore $! } return wrappedMap; }
@JRubyMethod(name = "assoc", compat = RUBY1_9) public IRubyObject assoc(final ThreadContext context, final IRubyObject obj) { return getOrCreateRubyHashMap().assoc(context, obj); }
@JRubyMethod(name = "default") public IRubyObject default_value_get(ThreadContext context) { return getOrCreateRubyHashMap().default_value_get(context); }
private RubyHashMap getOrCreateRubyHashMap() { if (wrappedMap == null) { wrappedMap = new RubyHashMap(getRuntime(), this); } // (JavaProxy)recv).getObject() might raise exception when // wrong number of args are given to the constructor. try { wrappedMap.setSize(((Map)((JavaProxy)this).getObject()).size()); } catch (RaiseException e) { wrappedMap.setSize(0); } return wrappedMap; }
private RubyHashMap getOrCreateRubyHashMap() { if (wrappedMap == null) { wrappedMap = new RubyHashMap(getRuntime(), this); } // (JavaProxy)recv).getObject() might raise exception when // wrong number of args are given to the constructor. try { wrappedMap.setSize(((Map)((JavaProxy)this).getObject()).size()); } catch (RaiseException e) { wrappedMap.setSize(0); } return wrappedMap; }
@JRubyMethod(name = "assoc") public IRubyObject assoc(final ThreadContext context, final IRubyObject obj) { return getOrCreateRubyHashMap().assoc(context, obj); }
@JRubyMethod(name = "default") public IRubyObject default_value_get(ThreadContext context, IRubyObject arg) { return getOrCreateRubyHashMap().default_value_get(context, arg); }
@JRubyMethod(name = "default") public IRubyObject default_value_get(ThreadContext context, IRubyObject arg) { return getOrCreateRubyHashMap().default_value_get(context, arg); }
@JRubyMethod(name = "assoc") public IRubyObject assoc(final ThreadContext context, final IRubyObject obj) { return getOrCreateRubyHashMap().assoc(context, obj); }
@JRubyMethod(name = "default") public IRubyObject default_value_get(ThreadContext context, IRubyObject arg) { return getOrCreateRubyHashMap().default_value_get(context, arg); }
@JRubyMethod(name = "default") public IRubyObject default_value_get(ThreadContext context) { return getOrCreateRubyHashMap().default_value_get(context); }
@JRubyMethod(name = "assoc", compat = RUBY1_9) public IRubyObject assoc(final ThreadContext context, final IRubyObject obj) { return getOrCreateRubyHashMap().assoc(context, obj); }
@JRubyMethod(name = "default") public IRubyObject default_value_get(ThreadContext context) { return getOrCreateRubyHashMap().default_value_get(context); }
@JRubyMethod(name = "default") public IRubyObject default_value_get(ThreadContext context) { return getOrCreateRubyHashMap().default_value_get(context); }
/** rb_hash_set_default * */ @JRubyMethod(name = "default=", required = 1) public IRubyObject default_value_set(final IRubyObject defaultValue) { return getOrCreateRubyHashMap().default_value_set(defaultValue); }
/** rb_hash_delete * */ @JRubyMethod(name = "delete") public IRubyObject delete(ThreadContext context, IRubyObject key, Block block) { return getOrCreateRubyHashMap().delete(context, key, block); }
/** rb_hash_each * */ @JRubyMethod(compat = RUBY1_8) public IRubyObject each(final ThreadContext context, final Block block) { return getOrCreateRubyHashMap().each(context, block); }
/** rb_hash_each_key * */ @JRubyMethod(name = "each_key") public IRubyObject each_key(final ThreadContext context, final Block block) { return getOrCreateRubyHashMap().each_key(context, block); }
/** rb_hash_set_default * */ @JRubyMethod(name = "default=", required = 1) public IRubyObject default_value_set(final IRubyObject defaultValue) { return getOrCreateRubyHashMap().default_value_set(defaultValue); }