Package org.jruby.runtime

Examples of org.jruby.runtime.PositionAware


    }

    public String getFilename() {
        DynamicMethod realMethod = method.getRealMethod(); // Follow Aliases
        if (realMethod instanceof PositionAware) {
            PositionAware poser = (PositionAware) realMethod;
            return poser.getFile();
        }
        return null;
    }
View Full Code Here


    }

    public int getLine() {
        DynamicMethod realMethod = method.getRealMethod(); // Follow Aliases
        if (realMethod instanceof PositionAware) {
            PositionAware poser = (PositionAware) realMethod;
            return poser.getLine() + 1;
        }
        return -1;
    }
View Full Code Here

    }

    public String getFilename() {
        DynamicMethod realMethod = method.getRealMethod(); // Follow Aliases
        if (realMethod instanceof PositionAware) {
            PositionAware poser = (PositionAware) realMethod;
            return poser.getFile();
        }
        return null;
    }
View Full Code Here

    }

    public int getLine() {
        DynamicMethod realMethod = method.getRealMethod(); // Follow Aliases
        if (realMethod instanceof PositionAware) {
            PositionAware poser = (PositionAware) realMethod;
            return poser.getLine() + 1;
        }
        return -1;
    }
View Full Code Here

    }

    public String getFilename() {
        DynamicMethod realMethod = method.getRealMethod(); // Follow Aliases
        if (realMethod instanceof PositionAware) {
            PositionAware poser = (PositionAware) realMethod;
            return poser.getFile();
        }
        return null;
    }
View Full Code Here

    }

    public int getLine() {
        DynamicMethod realMethod = method.getRealMethod(); // Follow Aliases
        if (realMethod instanceof PositionAware) {
            PositionAware poser = (PositionAware) realMethod;
            return poser.getLine() + 1;
        }
        return -1;
    }
View Full Code Here

    return methodSourceLocation(runtime, method);
  }

  public static IRubyObject methodSourceLocation(Ruby runtime, DynamicMethod method) {
    if (method instanceof PositionAware) {
      PositionAware positionAware = (PositionAware)method;
      return runtime.newArray(runtime.newString(positionAware.getFile()),
                              runtime.newFixnum(positionAware.getLine() + 1));
    } else if (method instanceof ProcMethod) {
      RubyProc proc = (RubyProc)getPrivateField(runtime, ProcMethod.class, "proc", method);
      String file = (String)getPrivateField(runtime, RubyProc.class, "file", proc);
      int line = getPrivateIntField(runtime, RubyProc.class, "line", proc);
      RubyString rubyFile = runtime.newString(file);
View Full Code Here

TOP

Related Classes of org.jruby.runtime.PositionAware

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.