class IDL::AST::Annotation
def initialize(id, fields = {})
def initialize(id, fields = {}) @id = id.to_sym # copy field map transforming all keys to symbols and # detecting nested annotation objects @fields = fields.inject({}) do |m, (k, v)| m[k.to_sym] = case v when Array v.collect { |ve| Hash === ve ? Annotation.new(*ve.to_a.first) : ve } when Hash Annotation.new(*v.to_a.first) else v end m end end