Sha256: ecc13df4cda161fad8dd13d9d484788dd72f888ac0a403c3a593affeada29c19

Contents?: true

Size: 957 Bytes

Versions: 135

Compression:

Stored size: 957 Bytes

Contents

/**
 * Copyright 2005-2007 Xue Yong Zhi
 * Distributed under the BSD License
 */

package com.xruby.runtime.builtin;

import org.apache.oro.text.regex.MatchResult;
import com.xruby.runtime.lang.*;
import com.xruby.runtime.lang.annotation.RubyLevelClass;
import com.xruby.runtime.lang.annotation.RubyLevelMethod;

@RubyLevelClass(name="MatchData")
public class RubyMatchData extends RubyBasic {
    private MatchResult result_;

    RubyMatchData(MatchResult m) {
        super(RubyRuntime.MatchDataClass);
        result_ = m;
    }

    @RubyLevelMethod(name="to_s")
    public RubyString to_s() {
        return ObjectFactory.createString(result_.toString());
    }

    public String toString() {
        return result_.group(0);
    }

    @RubyLevelMethod(name="[]")
    public RubyValue aref(RubyValue arg) {
        int index = arg.toInt();
        return ObjectFactory.createString(result_.group(index));
    }
}

Version data entries

135 entries across 135 versions & 2 rubygems

Version Path
rhodes-2.0.0.beta7 platform/shared/xruby/src/com/xruby/runtime/builtin/RubyMatchData.java
rhodes-2.0.0.beta6 platform/shared/xruby/src/com/xruby/runtime/builtin/RubyMatchData.java
rhodes-2.0.0.beta4 platform/shared/xruby/src/com/xruby/runtime/builtin/RubyMatchData.java
rhodes-2.0.0.beta3 platform/shared/xruby/src/com/xruby/runtime/builtin/RubyMatchData.java
rhodes-1.5.5 platform/shared/xruby/src/com/xruby/runtime/builtin/RubyMatchData.java
rhodes-2.0.0.beta2 platform/shared/xruby/src/com/xruby/runtime/builtin/RubyMatchData.java
rhodes-2.0.0.beta1 platform/shared/xruby/src/com/xruby/runtime/builtin/RubyMatchData.java
rhodes-1.5.4 platform/shared/xruby/src/com/xruby/runtime/builtin/RubyMatchData.java
rhodes-1.5.3 platform/shared/xruby/src/com/xruby/runtime/builtin/RubyMatchData.java
rhodes-1.5.2 platform/shared/xruby/src/com/xruby/runtime/builtin/RubyMatchData.java
rhodes-1.5.1 platform/shared/xruby/src/com/xruby/runtime/builtin/RubyMatchData.java
rhodes-1.5.0 platform/shared/xruby/src/com/xruby/runtime/builtin/RubyMatchData.java
rhodes-1.4.2 platform/shared/xruby/src/com/xruby/runtime/builtin/RubyMatchData.java
rhodes-1.4.1 platform/shared/xruby/src/com/xruby/runtime/builtin/RubyMatchData.java
rhodes-1.4.0 platform/shared/xruby/src/com/xruby/runtime/builtin/RubyMatchData.java