@JRubyMethod(name = "flatten") public IRubyObject flatten(ThreadContext context) { Ruby runtime = context.runtime; RubyArray result = new RubyArray(runtime, getType(), realLength); flatten(context, -1, result); result.infectBy(this); return result; }
@JRubyMethod(name = "flatten") public IRubyObject flatten(ThreadContext context) { Ruby runtime = context.runtime; RubyArray result = new RubyArray(runtime, getType(), realLength); flatten(context, -1, result); result.infectBy(this); return result; }
@JRubyMethod(name = "flatten") public IRubyObject flatten(ThreadContext context, IRubyObject arg) { Ruby runtime = context.runtime; int level = RubyNumeric.num2int(arg); if (level == 0) return makeShared(); RubyArray result = new RubyArray(runtime, getType(), realLength); flatten(context, level, result); result.infectBy(this); return result; }
@JRubyMethod(name = "flatten") public IRubyObject flatten(ThreadContext context, IRubyObject arg) { Ruby runtime = context.runtime; int level = RubyNumeric.num2int(arg); if (level == 0) return makeShared(); RubyArray result = new RubyArray(runtime, getType(), realLength); flatten(context, level, result); result.infectBy(this); return result; }
@JRubyMethod(name = "flatten!") public IRubyObject flatten_bang(ThreadContext context) { unpack(); modifyCheck(); RubyArray result = new RubyArray(context.runtime, getType(), realLength); if (flatten(context, -1, result)) { modifyCheck(); isShared = false; begin = 0; realLength = result.realLength; values = result.values; return this; } return context.nil; }
@JRubyMethod(name = "flatten!") public IRubyObject flatten_bang(ThreadContext context) { unpack(); modifyCheck(); RubyArray result = new RubyArray(context.runtime, getType(), realLength); if (flatten(context, -1, result)) { modifyCheck(); isShared = false; begin = 0; realLength = result.realLength; values = result.values; return this; } return context.nil; }
@JRubyMethod(name = "flatten!") public IRubyObject flatten_bang(ThreadContext context, IRubyObject arg) { unpack(); modifyCheck(); int level = RubyNumeric.num2int(arg); if (level == 0) return context.nil; RubyArray result = new RubyArray(context.runtime, getType(), realLength); if (flatten(context, level, result)) { isShared = false; begin = 0; realLength = result.realLength; values = result.values; return this; } return context.nil; }
@JRubyMethod(name = "flatten!") public IRubyObject flatten_bang(ThreadContext context, IRubyObject arg) { unpack(); modifyCheck(); int level = RubyNumeric.num2int(arg); if (level == 0) return context.nil; RubyArray result = new RubyArray(context.runtime, getType(), realLength); if (flatten(context, level, result)) { isShared = false; begin = 0; realLength = result.realLength; values = result.values; return this; } return context.nil; }
public void marshal(Object o, HierarchicalStreamWriter writer, MarshallingContext context) { RubyArray ra = (RubyArray) o; int len = ra.getLength(); resolver.marshal(ra,writer,context); writer.addAttribute("ruby-class", ra.getType().getName()); for (int i = 0; i < len; i++) { IRubyObject item = ra.entry(i); writer.startNode("item"); context.convertAnother(item); writer.endNode(); } }