Sha256: 11f0246a3dcfc37935d509f28574f0a4fa8959c4566b2a0245f293ba25e70ec5

Contents?: true

Size: 1.15 KB

Versions: 12

Compression:

Stored size: 1.15 KB

Contents

package org.cx4a.rsense.ruby;

public class MetaClass extends RubyClass {
    private IRubyObject attached;

    public MetaClass(Ruby runtime, RubyClass superClass) {
        super(runtime, superClass);
    }

    @Override
    public boolean isSingleton() {
        return true;
    }

    @Override
    public RubyClass getRealClass() {
        return superClass.getRealClass();
    }

    @Override
    public RubyClass makeMetaClass(RubyClass superClass) {
        RubyClass klass = super.makeMetaClass(superClass);
        klass.setSuperClass(getSuperClass().getRealClass().getMetaClass());
        return klass;
    }

    public IRubyObject getAttached() {
        return attached;
    }

    public void setAttached(IRubyObject attached) {
        this.attached = attached;
    }

    @Override
    public String getMethodPath(String name) {
        String path = attached.toString();
        if (name != null)
            path += "." + name;
        return path;
    }

    @Override
    public String toString() {
        if (attached instanceof RubyModule)
            return "<" + attached.toString() + ">";
        else
            return super.toString();
    }
}

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rsense-core-0.6.6 src/org/cx4a/rsense/ruby/MetaClass.java
rsense-core-0.6.5 src/org/cx4a/rsense/ruby/MetaClass.java
rsense-core-0.6.4 src/org/cx4a/rsense/ruby/MetaClass.java
rsense-core-0.6.2 src/org/cx4a/rsense/ruby/MetaClass.java
rsense-core-0.6.1 src/org/cx4a/rsense/ruby/MetaClass.java
rsense-core-0.6.0 src/org/cx4a/rsense/ruby/MetaClass.java
rsense-core-0.5.9 src/org/cx4a/rsense/ruby/MetaClass.java
rsense-core-0.5.8 src/org/cx4a/rsense/ruby/MetaClass.java
rsense-core-0.5.6 src/org/cx4a/rsense/ruby/MetaClass.java
rsense-core-0.5.2 src/org/cx4a/rsense/ruby/MetaClass.java
rsense-core-0.5.1 src/org/cx4a/rsense/ruby/MetaClass.java
rsense-core-0.5.0 src/org/cx4a/rsense/ruby/MetaClass.java