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-3.2.2 platform/shared/xruby/src/com/xruby/runtime/builtin/RubyMatchData.java
rhodes-3.2.2.beta platform/shared/xruby/src/com/xruby/runtime/builtin/RubyMatchData.java
rhodes-3.2.1 platform/shared/xruby/src/com/xruby/runtime/builtin/RubyMatchData.java
rhodes-3.2.0 platform/shared/xruby/src/com/xruby/runtime/builtin/RubyMatchData.java
rhodes-3.2.0.beta.9 platform/shared/xruby/src/com/xruby/runtime/builtin/RubyMatchData.java
rhodes-3.2.0.beta.8 platform/shared/xruby/src/com/xruby/runtime/builtin/RubyMatchData.java
rhodes-3.2.0.beta.7 platform/shared/xruby/src/com/xruby/runtime/builtin/RubyMatchData.java
rhodes-3.2.0.beta.6 platform/shared/xruby/src/com/xruby/runtime/builtin/RubyMatchData.java
rhodes-3.2.0.beta.5 platform/shared/xruby/src/com/xruby/runtime/builtin/RubyMatchData.java
rhodes-3.2.0.beta.4 platform/shared/xruby/src/com/xruby/runtime/builtin/RubyMatchData.java
rhodes-3.2.0.beta.2 platform/shared/xruby/src/com/xruby/runtime/builtin/RubyMatchData.java
rhodes-3.2.0.beta.1 platform/shared/xruby/src/com/xruby/runtime/builtin/RubyMatchData.java
rhodes-3.1.1 platform/shared/xruby/src/com/xruby/runtime/builtin/RubyMatchData.java
rhodes-3.1.1.beta platform/shared/xruby/src/com/xruby/runtime/builtin/RubyMatchData.java
rhodes-3.1.0 platform/shared/xruby/src/com/xruby/runtime/builtin/RubyMatchData.java
rhodes-3.1.0.beta.5 platform/shared/xruby/src/com/xruby/runtime/builtin/RubyMatchData.java
rhodes-3.1.0.beta.4 platform/shared/xruby/src/com/xruby/runtime/builtin/RubyMatchData.java
rhodes-3.1.0.beta.3 platform/shared/xruby/src/com/xruby/runtime/builtin/RubyMatchData.java
rhodes-3.1.0.beta.2 platform/shared/xruby/src/com/xruby/runtime/builtin/RubyMatchData.java
rhodes-3.1.0.beta.1 platform/shared/xruby/src/com/xruby/runtime/builtin/RubyMatchData.java