Refine search
@JRubyMethod(module = true) public static synchronized IRubyObject nprocessors(ThreadContext context, IRubyObject recv) { int nprocs = Runtime.getRuntime().availableProcessors(); return RubyFixnum.newFixnum(context.getRuntime(), nprocs); }
@Override @JRubyMethod(name = "flush_next_out") public IRubyObject flush_next_out(ThreadContext context) { return flushOutput(context.getRuntime()); }
@Override @JRubyMethod(name = "flush_next_out") public IRubyObject flush_next_out(ThreadContext context) { return flushOutput(context.getRuntime()); }
@JRubyMethod public IRubyObject flush_next_out(ThreadContext context, Block block) { return RubyString.newEmptyString(context.getRuntime()); }
@JRubyMethod(name = "size") public IRubyObject size(ThreadContext context) throws IOException { return context.getRuntime().newFixnum(bytesWritten); }
@JRubyMethod(name = "set_dictionary", required = 1) public IRubyObject set_dictionary(ThreadContext context, IRubyObject arg) { try { return set_dictionary(arg); } catch (IllegalArgumentException iae) { throw RubyZlib.newStreamError(context.getRuntime(), "stream error: " + iae.getMessage()); } }
/** * This returns the size of the encapsulated DataBag. * * @param context the context the method is being executed in * @return the size of the encapsulated DataBag */ @JRubyMethod(name={"size","length"}) public RubyFixnum size(ThreadContext context) { return RubyFixnum.newFixnum(context.getRuntime(), internalDB.size()); }
@JRubyMethod(name = "write", required = 1) public IRubyObject write(ThreadContext context, IRubyObject arg) throws IOException { writeToStream(arg); return context.getRuntime().getNil(); }
/** * This returns whether the encapsulated DatBag is distinct, per the sorted setting. * * @param context the context the method is being executed in * @return true if it the encapsulated is sorted, false otherwise */ @JRubyMethod(name = {"sorted?", "is_sorted?"}) public RubyBoolean isSorted(ThreadContext context) { return RubyBoolean.newBoolean(context.getRuntime(), internalDB.isSorted()); }
/** * Overrides ruby's hash leveraging DataByteArray's hash. * * @param context the context the method is being executed in * @return the encapsulated DataByteArray's hashCode() */ @JRubyMethod public IRubyObject hash(ThreadContext context) { return RubyFixnum.newFixnum(context.getRuntime(), internalDBA.hashCode()); }
/** * This method returns whether or not the encapsulated DataBag is empty. * * @param context the context the method is being executed in i @return true if the encapsulated DAtaBag is empty, false otherwise */ @JRubyMethod(name = "empty?") public RubyBoolean isEmpty(ThreadContext context) { return RubyBoolean.newBoolean(context.getRuntime(), internalDB.size() == 0); }
/** * @param context the context the method is being executed in * @return the string representation of the encapsulated DataByteArray */ @JRubyMethod(name = {"to_s", "inspect"}) public IRubyObject toString(ThreadContext context) { return RubyString.newString(context.getRuntime(), internalDBA.toString()); } }
/** * The toString method just leverages Schema's printing. * * @param context the context the method is being executed in * @return a String representation of the encapsulated Schema object */ @JRubyMethod(name = {"to_s", "inspect"}) public RubyString toString(ThreadContext context) { return RubyString.newString(context.getRuntime(), internalSchema.toString()); }
/** * @param context the context the method is being executed in * @return the size of the encapsulated Schema */ @JRubyMethod(name = {"size", "length"}) public RubyFixnum size(ThreadContext context) { return new RubyFixnum(context.getRuntime(), internalSchema.size()); }
/** * This returns whether the encapsulated DatBag is distinct, per the distinct setting. * * @param context the context the method is being executed in * @return true if it the encapsulated is distinct, false otherwise */ @JRubyMethod(name = {"distinct?", "is_distinct?"}) public RubyBoolean isDistinct(ThreadContext context) { return RubyBoolean.newBoolean(context.getRuntime(), internalDB.isDistinct()); }
/** * @param context the context the method is being executed in * @return a RubySchema copy of the Schema */ @JRubyMethod public RubySchema clone(ThreadContext context) { Ruby runtime = context.getRuntime(); return new RubySchema(runtime, runtime.getClass("Schema"), internalSchema); }
@JRubyMethod(name = "write", required = 1) public IRubyObject write(ThreadContext context, IRubyObject arg) throws IOException { writeToStream(arg); return context.getRuntime().getNil(); }
/** * @param context the context the method is being executed in * @return the size of the encapsulated DataByteArray */ @JRubyMethod(name = {"size", "length"}) public RubyFixnum size(ThreadContext context) { return RubyFixnum.newFixnum(context.getRuntime(), internalDBA.size()); }
@JRubyMethod(name = "printf", required = 1, rest = true) public IRubyObject printf(ThreadContext context, IRubyObject[] args) throws IOException { writeToStream(RubyKernel.sprintf(context, null, args)); return context.getRuntime().getNil(); }
@JRubyMethod(name = "int") public IRubyObject asInt(ThreadContext context) { final Ruby runtime = context.getRuntime(); validateDataSize(runtime, data, 4); return runtime.newFixnum(unpackInt(data)); }