本文整理汇总了Java中org.jruby.RubyHash.get方法的典型用法代码示例。如果您正苦于以下问题:Java RubyHash.get方法的具体用法?Java RubyHash.get怎么用?Java RubyHash.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jruby.RubyHash
的用法示例。
在下文中一共展示了RubyHash.get方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: applyEnvironment
import org.jruby.RubyHash; //导入方法依赖的package包/类
/**
* applyEnvironment
*
* @param container
*/
protected void applyEnvironment()
{
Ruby runtime = this.getRuntime();
IRubyObject env = runtime.getObject().getConstant(ENV_PROPERTY);
if (env != null && env instanceof RubyHash)
{
RubyHash hash = (RubyHash) env;
// save copy for later
this._originalEnvironment = (RubyHash) hash.dup();
hash.putAll(this.getContributedEnvironment());
// Grab all the matching env objects contributed via bundles that have scope matching!
IModelFilter filter = new ScopeFilter((String) hash.get("TM_CURRENT_SCOPE")); //$NON-NLS-1$
List<EnvironmentElement> envs = BundleManager.getInstance().getEnvs(filter);
ScopeSelector.sort(envs);
for (EnvironmentElement e : envs)
{
RubyProc invoke = e.getInvokeBlock();
if (invoke != null)
{
invoke.call(runtime.getCurrentContext(), new IRubyObject[] { hash });
}
}
}
}
示例2: setHashParameters
import org.jruby.RubyHash; //导入方法依赖的package包/类
private void setHashParameters(Transformer transformer, RubyHash hash) {
Set<String> keys = hash.keySet();
for (String key : keys) {
String value = (String)hash.get(key);
transformer.setParameter(key, unparseValue(value));
}
}
示例3: getStringFromHash
import org.jruby.RubyHash; //导入方法依赖的package包/类
public static String getStringFromHash(RubyHash target, String key) {
try {
Object value = target.get(key);
if (value != null)
return value.toString();
return null;
} catch (Exception e) {
return null;
}
}
示例4: toJavaHash
import org.jruby.RubyHash; //导入方法依赖的package包/类
public static Map<?, ?> toJavaHash(RubyHash rubyHash) {
HashMap<Object, Object> map = new HashMap<Object, Object>();
Set<?> keySet = rubyHash.keySet();
for (Object rubyKey : keySet) {
Object rubyValue = rubyHash.get(rubyKey);
Object javaKey = toJavaObject(rubyKey);
Object javaValue = toJavaObject(rubyValue);
map.put(javaKey, javaValue);
}
return map;
}
示例5: performCalabashAction
import org.jruby.RubyHash; //导入方法依赖的package包/类
/**
* call calabash's perform_action function with action and its corresponding args
* eg:
* performCalabashAction("click_on_screen","50","100");
*
* @param action action to be performed
* @param args list of arguments for the action
* @throws CalabashException
*/
public ActionResult performCalabashAction(String action, String... args) throws CalabashException {
final RubyHash rubyResult = calabashWrapper.performAction(action, args);
final RubyArray bonusInformationArray = (RubyArray) rubyResult.get("bonusInformation");
final String message = rubyResult.get("message").toString();
final boolean success = Boolean.parseBoolean(rubyResult.get("success").toString());
final Object[] bonusInformation = Utils.toJavaArray(bonusInformationArray);
return new ActionResult(bonusInformation, message, success);
}