Sha256: 2adf19af405662cc831f40cf954f286f5a063e4266cdd133d898ff944e404d50

Contents?: true

Size: 1.98 KB

Versions: 19

Compression:

Stored size: 1.98 KB

Contents

package org.ruboto;

public class ScriptInfo {
    public static final String CLASS_NAME_KEY = "RUBOTO_CLASS_NAME";
    public static final String SCRIPT_NAME_KEY = "RUBOTO_SCRIPT_NAME";
    private String rubyClassName;
    private String scriptName;
    private Object rubyInstance;

    public boolean isReadyToLoad() {
        return rubyClassName != null || scriptName != null;
    }

    public boolean isLoaded() {
        return rubyInstance != null;
    }

    public void setFromIntent(android.content.Intent intent) {

        // FIXME(uwe):  Deprecated as of Ruboto 0.13.0.  Remove in june 2014 (twelve months).
        android.os.Bundle configBundle = intent.getBundleExtra("Ruboto Config");
        if (configBundle != null) {
            if (configBundle.containsKey("ClassName")) {
                setRubyClassName(configBundle.getString("ClassName"));
            }
            if (configBundle.containsKey("Script")) {
                setScriptName(configBundle.getString("Script"));
            }
        }
        // EMXIF

        if (intent.hasExtra(CLASS_NAME_KEY)) {
            setRubyClassName(intent.getStringExtra(CLASS_NAME_KEY));
        }
        if (intent.hasExtra(SCRIPT_NAME_KEY)) {
            setScriptName(intent.getStringExtra(SCRIPT_NAME_KEY));
        }
    }

    public String getRubyClassName() {
        if (rubyClassName == null && scriptName != null) {
            return Script.toCamelCase(scriptName);
         }
        return rubyClassName;
    }

    public void setRubyClassName(String name) {
        rubyClassName = name;
    }

    public Object getRubyInstance() {
        return rubyInstance;
    }

    public void setRubyInstance(Object instance) {
        rubyInstance = instance;
    }

    public String getScriptName() {
        if (scriptName == null && rubyClassName != null) {
            return Script.toSnakeCase(rubyClassName) + ".rb";
        }
        return scriptName;
    }

    public void setScriptName(String name) {
        scriptName = name;
    }

}

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
ruboto-1.6.1 assets/src/org/ruboto/ScriptInfo.java
ruboto-1.6.0 assets/src/org/ruboto/ScriptInfo.java
ruboto-1.5.0 assets/src/org/ruboto/ScriptInfo.java
ruboto-1.4.1 assets/src/org/ruboto/ScriptInfo.java
ruboto-1.4.0 assets/src/org/ruboto/ScriptInfo.java
ruboto-1.3.1 assets/src/org/ruboto/ScriptInfo.java
ruboto-1.3.0 assets/src/org/ruboto/ScriptInfo.java
ruboto-1.2.0 assets/src/org/ruboto/ScriptInfo.java
ruboto-1.1.2 assets/src/org/ruboto/ScriptInfo.java
ruboto-1.1.1 assets/src/org/ruboto/ScriptInfo.java
ruboto-1.1.0 assets/src/org/ruboto/ScriptInfo.java
ruboto-1.0.3 assets/src/org/ruboto/ScriptInfo.java
ruboto-1.0.2 assets/src/org/ruboto/ScriptInfo.java
ruboto-1.0.1 assets/src/org/ruboto/ScriptInfo.java
ruboto-1.0.0 assets/src/org/ruboto/ScriptInfo.java
ruboto-0.16.0 assets/src/org/ruboto/ScriptInfo.java
ruboto-0.15.0 assets/src/org/ruboto/ScriptInfo.java
ruboto-0.14.0 assets/src/org/ruboto/ScriptInfo.java
ruboto-0.13.0 assets/src/org/ruboto/ScriptInfo.java