All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jruby.util.DefinedMessage Maven / Gradle / Ivy

There is a newer version: 9.4.9.0
Show newest version
package org.jruby.util;

import java.util.HashMap;
import java.util.Map;

/**
 * An enum for all "defined?" messages.
 */
public enum DefinedMessage {
    EXPRESSION("expression"),
    ASSIGNMENT("assignment"),
    GLOBAL_VARIABLE("global-variable"),
    METHOD("method"),
    CLASS_VARIABLE("class variable"),
    CONSTANT("constant"),
    LOCAL_VARIABLE("local-variable"),
    LOCAL_VARIABLE_IN_BLOCK("local-variable(in-block)"),
    FALSE("false"),
    INSTANCE_VARIABLE("instance-variable"),
    NIL("nil"),
    SELF("self"),
    SUPER("super"),
    TRUE("true"),
    YIELD("yield"),
    BACKREF_AMPERSAND("$&"),
    BACKREF_PLUS("$+"),
    BACKREF_BACKTICK("$`"),
    BACKREF_SQUOTE("$'"),
    BACKREF_ONE("$1"),
    BACKREF_TWO("$2"),
    BACKREF_THREE("$3"),
    BACKREF_FOUR("$4"),
    BACKREF_FIVE("$5"),
    BACKREF_SIX("$6"),
    BACKREF_SEVEN("$7"),
    BACKREF_EIGHT("$8"),
    BACKREF_NINE("$9");

    private static final Map byText = new HashMap();

    static {
        for (DefinedMessage definedMessage : values()) {
            byText.put(definedMessage.getText(), definedMessage);
        }
    }

    public String getText() {
        return text;
    }

    public static DefinedMessage byText(String text) {
        return byText.get(text);
    }

    private DefinedMessage(String text) {
        this.text = text;
    }

    private final String text;
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy