Class: MendixBridge::EnumerationParser

Inherits:
Object
  • Object
show all
Defined in:
lib/mendix_bridge/enumeration_parser.rb

Class Method Summary collapse

Class Method Details

.parse(description) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/mendix_bridge/enumeration_parser.rb', line 6

def parse(description)
  mdl = description.fetch("mdl")
  body = mdl[
    /\benumeration\s+[\w.]+\s*\(\s*(?<body>.*?)\s*\)\s*(?:FOLDER\b|;)/im,
    :body
  ]

  return { "mdl" => mdl, "parse_status" => "unsupported" } unless body

  {
    "values" => parse_values(body),
    "folder" => mdl[/\bFOLDER\s+'((?:''|[^'])*)'/i, 1]&.gsub("''", "'"),
    "mdl" => mdl,
    "parse_status" => "parsed"
  }.compact
end