Ejemplo n.º 1
0
 public WarningGlobalVariable(
     Ruby runtime, String name, RubyInstanceConfig.Verbosity verbosity) {
   super(
       runtime,
       name,
       verbosity == RubyInstanceConfig.Verbosity.NIL
           ? RubyFixnum.newFixnum(runtime, 0)
           : verbosity == RubyInstanceConfig.Verbosity.FALSE
               ? RubyFixnum.newFixnum(runtime, 1)
               : verbosity == RubyInstanceConfig.Verbosity.TRUE
                   ? RubyFixnum.newFixnum(runtime, 2)
                   : runtime.getNil());
 }
Ejemplo n.º 2
0
 @Override
 public IRubyObject set(IRubyObject value) {
   runtime
       .getWarnings()
       .warnOnce(ID.SAFE_NOT_SUPPORTED, "SAFE levels are not supported in JRuby");
   return RubyFixnum.zero(runtime);
 }
Ejemplo n.º 3
0
 private RubyString getCorrectKey(IRubyObject key, ThreadContext context) {
   RubyString originalKey = key.convertToString();
   RubyString actualKey = originalKey;
   Ruby runtime = context.runtime;
   if (Platform.IS_WINDOWS) {
     // this is a rather ugly hack, but similar to MRI. See hash.c:ruby_setenv and similar in MRI
     // we search all keys for a case-insensitive match, and use that
     RubyArray keys = super.keys();
     for (int i = 0; i < keys.size(); i++) {
       RubyString candidateKey = keys.eltInternal(i).convertToString();
       if (candidateKey
           .casecmp(context, originalKey)
           .op_equal(context, RubyFixnum.zero(runtime))
           .isTrue()) {
         actualKey = candidateKey;
         break;
       }
     }
   }
   return actualKey;
 }
Ejemplo n.º 4
0
 @Override
 public IRubyObject get() {
   return RubyFixnum.zero(runtime);
 }