Method: GLib::EnumDefinition#parse_const_lines
- Defined in:
- lib/glib-mkenums.rb
#parse_const_lines(const_lines) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/glib-mkenums.rb', line 31 def parse_const_lines(const_lines) if [:force_flags] or /<</ =~ const_lines @type = "flags" @Type = "Flags" else @type = "enum" @Type = "Enum" end constants = [] const_lines.scan(/^\s*([^\s,]*).*\n/) do |name| constants << name[0] unless name[0] =~ /(^[\/\*]|^#|^$)/ end @prefix = extract_prefix(constants) constants.each do |name| @constants << [name, name.sub(/#{@prefix}/, "").gsub(/_/, "-").downcase] end end |