本文整理了Java中org.jruby.Ruby.getCurrentLine
方法的一些代码示例,展示了Ruby.getCurrentLine
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ruby.getCurrentLine
方法的具体详情如下:
包路径:org.jruby.Ruby
类名称:Ruby
方法名:getCurrentLine
暂无
代码示例来源:origin: org.jruby/jruby-complete
@Override
public IRubyObject get() {
return runtime.newFixnum(runtime.getCurrentLine());
}
}
代码示例来源:origin: org.jruby/jruby-core
@Override
public IRubyObject get() {
return runtime.newFixnum(runtime.getCurrentLine());
}
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
@Override
public IRubyObject get() {
return runtime.newFixnum(runtime.getCurrentLine());
}
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
@Override
public IRubyObject get() {
return runtime.newFixnum(runtime.getCurrentLine());
}
}
代码示例来源:origin: org.jruby/jruby-complete
@JRubyMethod(name = "lineno")
public static IRubyObject lineno(ThreadContext context, IRubyObject recv) {
return context.runtime.newFixnum(context.runtime.getCurrentLine());
}
代码示例来源:origin: org.jruby/jruby-core
@JRubyMethod(name = "lineno")
public static IRubyObject lineno(ThreadContext context, IRubyObject recv) {
return context.runtime.newFixnum(context.runtime.getCurrentLine());
}
代码示例来源:origin: org.jruby/jruby-complete
public void incrementLineno(Ruby runtime, RubyIO io) {
boolean locked = lock();
try {
lineno++;
if (RubyArgsFile.ArgsFileData.getArgsFileData(runtime).isCurrentFile(io)) {
runtime.setCurrentLine(runtime.getCurrentLine() + 1);
} else {
runtime.setCurrentLine(lineno);
}
} finally {
if (locked) unlock();
}
}
代码示例来源:origin: org.jruby/jruby-core
public void incrementLineno(Ruby runtime, RubyIO io) {
boolean locked = lock();
try {
lineno++;
if (RubyArgsFile.ArgsFileData.getArgsFileData(runtime).isCurrentFile(io)) {
runtime.setCurrentLine(runtime.getCurrentLine() + 1);
} else {
runtime.setCurrentLine(lineno);
}
} finally {
if (locked) unlock();
}
}
代码示例来源:origin: org.jruby/jruby-complete
public void loadFromClassLoader(ClassLoader classLoader, String file, boolean wrap) {
long startTime = loadTimer.startLoad("classloader:" + file);
int currentLine = runtime.getCurrentLine();
try {
SearchState state = new SearchState(file);
state.prepareLoadSearch(file);
Library library = null;
LoadServiceResource resource = getClassPathResource(classLoader, file);
if (resource != null) {
state.setLoadName(resolveLoadName(resource, file));
library = createLibrary(state, resource);
}
if (library == null) {
throw runtime.newLoadError("no such file to load -- " + file);
}
try {
library.load(runtime, wrap);
} catch (IOException e) {
debugLoadException(runtime, e);
throw newLoadErrorFromThrowable(runtime, file, e);
}
} finally {
runtime.setCurrentLine(currentLine);
loadTimer.endLoad("classloader:" + file, startTime);
}
}
代码示例来源:origin: org.jruby/jruby-core
public void loadFromClassLoader(ClassLoader classLoader, String file, boolean wrap) {
long startTime = loadTimer.startLoad("classloader:" + file);
int currentLine = runtime.getCurrentLine();
try {
SearchState state = new SearchState(file);
state.prepareLoadSearch(file);
Library library = null;
LoadServiceResource resource = getClassPathResource(classLoader, file);
if (resource != null) {
state.setLoadName(resolveLoadName(resource, file));
library = createLibrary(state, resource);
}
if (library == null) {
throw runtime.newLoadError("no such file to load -- " + file);
}
try {
library.load(runtime, wrap);
} catch (IOException e) {
debugLoadException(runtime, e);
throw newLoadErrorFromThrowable(runtime, file, e);
}
} finally {
runtime.setCurrentLine(currentLine);
loadTimer.endLoad("classloader:" + file, startTime);
}
}
代码示例来源:origin: org.jruby/jruby-complete
@JRubyMethod
public RubyFixnum rewind(ThreadContext context) {
Ruby runtime = context.runtime;
OpenFile fptr;
fptr = getOpenFileChecked();
boolean locked = fptr.lock();
try {
if (fptr.seek(context, 0L, 0) == -1 && fptr.errno() != null) {
throw runtime.newErrnoFromErrno(fptr.errno(), fptr.getPath());
}
if (RubyArgsFile.ArgsFileData.getArgsFileData(runtime).isCurrentFile(this)) {
runtime.setCurrentLine(runtime.getCurrentLine() - fptr.getLineNumber());
}
fptr.setLineNumber(0);
if (fptr.readconv != null) {
fptr.clearReadConversion();
}
} finally {
if (locked) fptr.unlock();
}
return RubyFixnum.zero(runtime);
}
代码示例来源:origin: org.jruby/jruby-core
@JRubyMethod
public RubyFixnum rewind(ThreadContext context) {
Ruby runtime = context.runtime;
OpenFile fptr;
fptr = getOpenFileChecked();
boolean locked = fptr.lock();
try {
if (fptr.seek(context, 0L, 0) == -1 && fptr.errno() != null) {
throw runtime.newErrnoFromErrno(fptr.errno(), fptr.getPath());
}
if (RubyArgsFile.ArgsFileData.getArgsFileData(runtime).isCurrentFile(this)) {
runtime.setCurrentLine(runtime.getCurrentLine() - fptr.getLineNumber());
}
fptr.setLineNumber(0);
if (fptr.readconv != null) {
fptr.clearReadConversion();
}
} finally {
if (locked) fptr.unlock();
}
return RubyFixnum.zero(runtime);
}
代码示例来源:origin: org.jruby/jruby-complete
public void load(String file, boolean wrap) {
long startTime = loadTimer.startLoad(file);
int currentLine = runtime.getCurrentLine();
try {
if(!runtime.getProfile().allowLoad(file)) {
throw runtime.newLoadError("no such file to load -- " + file, file);
}
SearchState state = new SearchState(file);
state.prepareLoadSearch(file);
Library library = findLibraryBySearchState(state);
// load() will do a last chance look in current working directory for the file (see load.c:rb_f_load()).
if (library == null) {
FileResource fileResource = JRubyFile.createResourceAsFile(runtime, file);
if (!fileResource.exists()) throw runtime.newLoadError("no such file to load -- " + file, file);
library = LibrarySearcher.ResourceLibrary.create(file, file, fileResource);
}
try {
library.load(runtime, wrap);
} catch (IOException e) {
debugLoadException(runtime, e);
throw newLoadErrorFromThrowable(runtime, file, e);
}
} finally {
runtime.setCurrentLine(currentLine);
loadTimer.endLoad(file, startTime);
}
}
代码示例来源:origin: org.jruby/jruby-core
public void load(String file, boolean wrap) {
long startTime = loadTimer.startLoad(file);
int currentLine = runtime.getCurrentLine();
try {
if(!runtime.getProfile().allowLoad(file)) {
throw runtime.newLoadError("no such file to load -- " + file, file);
}
SearchState state = new SearchState(file);
state.prepareLoadSearch(file);
Library library = findLibraryBySearchState(state);
// load() will do a last chance look in current working directory for the file (see load.c:rb_f_load()).
if (library == null) {
FileResource fileResource = JRubyFile.createResourceAsFile(runtime, file);
if (!fileResource.exists()) throw runtime.newLoadError("no such file to load -- " + file, file);
library = LibrarySearcher.ResourceLibrary.create(file, file, fileResource);
}
try {
library.load(runtime, wrap);
} catch (IOException e) {
debugLoadException(runtime, e);
throw newLoadErrorFromThrowable(runtime, file, e);
}
} finally {
runtime.setCurrentLine(currentLine);
loadTimer.endLoad(file, startTime);
}
}
内容来源于网络,如有侵权,请联系作者删除!