}
@SuppressWarnings("unchecked")
public void parse(DeploymentUnit unit, Object dataObj) throws Exception {
RubyRuntimeMetaData runtimeMetaData = unit.getAttachment( RubyRuntimeMetaData.ATTACHMENT_KEY );
if (runtimeMetaData == null) {
log.debug( "Initializing ruby runtime metadata: " + unit );
runtimeMetaData = new RubyRuntimeMetaData();
unit.putAttachment( RubyRuntimeMetaData.ATTACHMENT_KEY, runtimeMetaData );
}
Map<String, Object> config = (Map<String, Object>) dataObj;
Object version = config.get( "version" );
if ("1.8".equals( "" + version )) {
runtimeMetaData.setVersion( RubyRuntimeMetaData.Version.V1_8 );
} else if ("1.9".equals( "" + version )) {
runtimeMetaData.setVersion( RubyRuntimeMetaData.Version.V1_9 );
} else if ("2.0".equals( "" + version )) {
runtimeMetaData.setVersion( RubyRuntimeMetaData.Version.V2_0 );
}
Object compileMode = config.get( "compile_mode" );
if ("false".equals( "" + compileMode )) { // 'off' becomes 'false' via
// the yml parser
runtimeMetaData.setCompileMode( RubyRuntimeMetaData.CompileMode.OFF );
} else if ("jit".equals( "" + compileMode )) {
runtimeMetaData.setCompileMode( RubyRuntimeMetaData.CompileMode.JIT );
} else if ("force".equals( "" + compileMode )) {
runtimeMetaData.setCompileMode( RubyRuntimeMetaData.CompileMode.FORCE );
}
Object debug = config.get( "debug" );
if ("false".equals( "" + debug )) {
runtimeMetaData.setDebug( false );
} else if ("true".equals( "" + debug )) {
runtimeMetaData.setDebug( true );
}
Object interactive = config.get( "interactive" );
if ("false".equals( "" + interactive )) {
runtimeMetaData.setInteractive( false );
} else if ("true".equals( "" + interactive )) {
runtimeMetaData.setInteractive( true );
}
Object profileApi = config.get( "profile_api" );
if (profileApi != null) {
runtimeMetaData.setProfileApi( (Boolean) profileApi );
}
}