}
public List<TypeFragment> loadTypeFragments(File rbFile) throws IOException, RubySyntaxException {
List<TypeFragment> result = Lists.newArrayList();
for(PPTypeInfo type : getTypeFragments(rbFile)) {
TypeFragment fragment = PPTPFactory.eINSTANCE.createTypeFragment();
fragment.setName(type.getTypeName());
// add the properties (will typically load just one).
for(Map.Entry<String, PPTypeInfo.Entry> entry : type.getProperties().entrySet()) {
Property property = PPTPFactory.eINSTANCE.createProperty();
property.setName(entry.getKey());
property.setDocumentation(entry.getValue().documentation);
property.setRequired(entry.getValue().isRequired());
fragment.getProperties().add(property);
}
// add the parameters (will typically load just one).
for(Map.Entry<String, PPTypeInfo.Entry> entry : type.getParameters().entrySet()) {
Parameter parameter = PPTPFactory.eINSTANCE.createParameter();
parameter.setName(entry.getKey());
parameter.setDocumentation(entry.getValue().documentation);
parameter.setRequired(entry.getValue().isRequired());
fragment.getParameters().add(parameter);
}
result.add(fragment);
}
return result;