Method: Docurium::DocParser#extract_fields

Defined in:
lib/docurium/docparser.rb

#extract_fields(cursor) ⇒ Object



295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
# File 'lib/docurium/docparser.rb', line 295

def extract_fields(cursor)
  fields = []
  cursor.visit_children do |cchild, cparent|
    field = {
      :type => cchild.type.spelling,
      :name => cchild.spelling,
      :comments => cchild.comment.find_all {|c| c.kind == :comment_paragraph }.map(&:text).join("\n\n")
    }

    if cursor.kind == :cursor_enum_decl
      field.merge!({:value => cchild.enum_value})
    end

    fields << field
    :continue
  end

    fields
end