Returning class type in ruby
I need a function that checks the namespace of the argument, and returns the class type
for example:
checkType(id)
if id starts with "p:"
return <Cl开发者_StackOverflow社区ass Type>
end
I do not have an instance to use when checking the type of the id
It's kind of a lame, hackish approach, but if you know what the IDs are that you're looking for, and there's not too many, you could create a hash mapping of ID to ClassType.
精彩评论