当前位置: 首页>>代码示例>>Java>>正文


Java RubyRuntimeAdapter类代码示例

本文整理汇总了Java中org.jruby.RubyRuntimeAdapter的典型用法代码示例。如果您正苦于以下问题:Java RubyRuntimeAdapter类的具体用法?Java RubyRuntimeAdapter怎么用?Java RubyRuntimeAdapter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RubyRuntimeAdapter类属于org.jruby包,在下文中一共展示了RubyRuntimeAdapter类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: map

import org.jruby.RubyRuntimeAdapter; //导入依赖的package包/类
@Override
public void map(LongWritable key, Text value,
        OutputCollector<Text, Text> outputCollector, Reporter arg3) throws IOException {
    Ruby runtime = Ruby.getGlobalRuntime();
    RubyRuntimeAdapter adapter = JavaEmbedUtils.newRuntimeAdapter();
    IRubyObject receiver = adapter.eval(runtime, mapper_code);
    IRubyObject rubyKey = JavaUtil.convertJavaToRuby(runtime, key);
    IRubyObject rubyValue = JavaUtil.convertJavaToRuby(runtime, value);
    MapleRoadCollector collector =
            new MapleRoadCollector(keyText, valueText, outputCollector);
    IRubyObject rubyCollector = JavaUtil.convertJavaToRuby(runtime, collector);
    Helpers.invoke(runtime.getCurrentContext(), receiver, "map", rubyKey, rubyValue, rubyCollector);
}
 
开发者ID:yokolet,项目名称:mapleroad,代码行数:14,代码来源:MapleRoadMapper.java

示例2: reduce

import org.jruby.RubyRuntimeAdapter; //导入依赖的package包/类
@Override
public void reduce(Text key, Iterator<IntWritable> values,
        OutputCollector<Text, IntWritable> outputCollector, Reporter arg3) throws IOException {;
    Ruby runtime = Ruby.getGlobalRuntime();
    RubyRuntimeAdapter adapter = JavaEmbedUtils.newRuntimeAdapter();
    IRubyObject receiver = adapter.eval(runtime, reducer_code);
    IRubyObject rubyKey = JavaUtil.convertJavaToRuby(runtime, key);
    IRubyObject rubyValues = JavaUtil.convertJavaToRuby(runtime, values);
    MapleRoadCollectorTextInt collector =
            new MapleRoadCollectorTextInt(keyText, valueInt, outputCollector);
    IRubyObject rubyCollector = JavaUtil.convertJavaToRuby(runtime, collector);
    Helpers.invoke(runtime.getCurrentContext(), receiver, "reduce", rubyKey, rubyValues, rubyCollector);
}
 
开发者ID:yokolet,项目名称:mapleroad,代码行数:14,代码来源:MapleRoadReducerTextInt.java

示例3: map

import org.jruby.RubyRuntimeAdapter; //导入依赖的package包/类
@Override
public void map(LongWritable key, Text value,
        OutputCollector<Text, IntWritable> outputCollector, Reporter arg3) throws IOException {
    Ruby runtime = Ruby.getGlobalRuntime();
    RubyRuntimeAdapter adapter = JavaEmbedUtils.newRuntimeAdapter();
    IRubyObject receiver = adapter.eval(runtime, mapper_code);
    IRubyObject rubyKey = JavaUtil.convertJavaToRuby(runtime, key);
    IRubyObject rubyValue = JavaUtil.convertJavaToRuby(runtime, value);
    MapleRoadCollectorTextInt collector =
            new MapleRoadCollectorTextInt(keyText, valueInt, outputCollector);
    IRubyObject rubyCollector = JavaUtil.convertJavaToRuby(runtime, collector);
    Helpers.invoke(runtime.getCurrentContext(), receiver, "map", rubyKey, rubyValue, rubyCollector);
}
 
开发者ID:yokolet,项目名称:mapleroad,代码行数:14,代码来源:MapleRoadMapperTextInt.java

示例4: reduce

import org.jruby.RubyRuntimeAdapter; //导入依赖的package包/类
@Override
public void reduce(Text key, Iterator<Text> values,
        OutputCollector<Text, Text> outputCollector, Reporter arg3) throws IOException {;
    Ruby runtime = Ruby.getGlobalRuntime();
    RubyRuntimeAdapter adapter = JavaEmbedUtils.newRuntimeAdapter();
    IRubyObject receiver = adapter.eval(runtime, reducer_code);
    IRubyObject rubyKey = JavaUtil.convertJavaToRuby(runtime, key);
    IRubyObject rubyValues = JavaUtil.convertJavaToRuby(runtime, values);
    MapleRoadCollector collector =
            new MapleRoadCollector(keyText, valueText, outputCollector);
    IRubyObject rubyCollector = JavaUtil.convertJavaToRuby(runtime, collector);
    Helpers.invoke(runtime.getCurrentContext(), receiver, "reduce", rubyKey, rubyValues, rubyCollector);
}
 
开发者ID:yokolet,项目名称:mapleroad,代码行数:14,代码来源:MapleRoadReducer.java

示例5: DefaultCssResolver

import org.jruby.RubyRuntimeAdapter; //导入依赖的package包/类
public DefaultCssResolver(Ruby runtime, RubyRuntimeAdapter evaler) {
    this.runtime = runtime;
    this.evaler = evaler;
}
 
开发者ID:asciidoctor,项目名称:asciidoctorj,代码行数:5,代码来源:DefaultCssResolver.java


注:本文中的org.jruby.RubyRuntimeAdapter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。