Package org.jruby.runtime.builtin

Examples of org.jruby.runtime.builtin.InstanceVariables


        updateInstanceVar(receiver, vars);
        updateInstanceVar((RubyObject)receiver.getRuntime().getTopSelf(), vars);
    }

    static void updateInstanceVar(RubyObject receiver, BiVariableMap vars) {
        InstanceVariables ivars = receiver.getInstanceVariables();
        List<String> keys = ivars.getInstanceVariableNameList();
        for (String key : keys) {
            IRubyObject value = ivars.fastGetInstanceVariable(key);
            BiVariable var = vars.getVariable(receiver, key);
            if (var != null) {
                var.setRubyObject(value);
            } else {
                var = new InstanceVariable(receiver, key, value);
View Full Code Here


     * @param receiver receiver object returned when a script is evaluated.
     * @param vars map to save retrieved instance variables.
     * @param key instace varible name
     */
    public static void retrieveByKey(RubyObject receiver, BiVariableMap vars, String key) {
        InstanceVariables ivars = receiver.getInstanceVariables();

        // if the specified key doesn't exist, this method is called before the
        // evaluation. Don't update value in this case.
        if (!ivars.getInstanceVariableNameList().contains(key)) return;

        // the specified key is found, so let's update
        IRubyObject value = ivars.fastGetInstanceVariable(key);
        BiVariable var = vars.getVariable(receiver, key);
        if (var != null) {
            var.setRubyObject(value);
        } else {
            var = new InstanceVariable(receiver, key, value);
View Full Code Here

        updateInstanceVar(receiver, vars);
        updateInstanceVar((RubyObject)receiver.getRuntime().getTopSelf(), vars);
    }

    static void updateInstanceVar(RubyObject receiver, BiVariableMap vars) {
        InstanceVariables ivars = receiver.getInstanceVariables();
        List<String> keys = ivars.getInstanceVariableNameList();
        for (String key : keys) {
            IRubyObject value = ivars.getInstanceVariable(key);
            BiVariable var = vars.getVariable(receiver, key);
            if (var != null) {
                var.setRubyObject(value);
            } else {
                var = new InstanceVariable(receiver, key, value);
View Full Code Here

     * @param receiver receiver object returned when a script is evaluated.
     * @param vars map to save retrieved instance variables.
     * @param key instace varible name
     */
    public static void retrieveByKey(RubyObject receiver, BiVariableMap vars, String key) {
        InstanceVariables ivars = receiver.getInstanceVariables();

        // if the specified key doesn't exist, this method is called before the
        // evaluation. Don't update value in this case.
        if (!ivars.getInstanceVariableNameList().contains(key)) return;

        // the specified key is found, so let's update
        IRubyObject value = ivars.getInstanceVariable(key);
        BiVariable var = vars.getVariable(receiver, key);
        if (var != null) {
            var.setRubyObject(value);
        } else {
            var = new InstanceVariable(receiver, key, value);
View Full Code Here

        updateInstanceVar(receiver, vars);
        updateInstanceVar((RubyObject)receiver.getRuntime().getTopSelf(), vars);
    }

    static void updateInstanceVar(RubyObject receiver, BiVariableMap vars) {
        InstanceVariables ivars = receiver.getInstanceVariables();
        List<String> keys = ivars.getInstanceVariableNameList();
        for (String key : keys) {
            IRubyObject value = ivars.getInstanceVariable(key);
            BiVariable var = vars.getVariable(receiver, key);
            if (var != null) {
                var.setRubyObject(value);
            } else {
                var = new InstanceVariable(receiver, key, value);
View Full Code Here

     * @param receiver receiver object returned when a script is evaluated.
     * @param vars map to save retrieved instance variables.
     * @param key instace varible name
     */
    public static void retrieveByKey(RubyObject receiver, BiVariableMap vars, String key) {
        InstanceVariables ivars = receiver.getInstanceVariables();

        // if the specified key doesn't exist, this method is called before the
        // evaluation. Don't update value in this case.
        if (!ivars.getInstanceVariableNameList().contains(key)) return;

        // the specified key is found, so let's update
        IRubyObject value = ivars.getInstanceVariable(key);
        BiVariable var = vars.getVariable(receiver, key);
        if (var != null) {
            var.setRubyObject(value);
        } else {
            var = new InstanceVariable(receiver, key, value);
View Full Code Here

  public static void listInstanceVariables(
    String name, RubyObject object) {

    System.out.println("Instance variables of " + name + ":");
    InstanceVariables vars = object.getInstanceVariables();
   
    List<String> l = vars.getInstanceVariableNameList();
    for (String s : l) {
      System.out.println("  " + s + " = " + vars.getInstanceVariable(s).asJavaString());
  }
  }
View Full Code Here

TOP

Related Classes of org.jruby.runtime.builtin.InstanceVariables

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.