Class: Stepmod::Utils::Concept

Inherits:
Object
  • Object
show all
Defined in:
lib/stepmod/utils/concept.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Concept

Returns a new instance of Concept.



17
18
19
20
21
# File 'lib/stepmod/utils/concept.rb', line 17

def initialize(options)
  options.each_pair do |k, v|
    send("#{k}=", v)
  end
end

Class Method Details

.parse(definition_xml, reference_anchor:, reference_clause:, file_path:) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/stepmod/utils/concept.rb', line 23

def self.parse(definition_xml, reference_anchor:, reference_clause:, file_path:)
  converted_definition = Stepmod::Utils::StepmodDefinitionConverter.convert(
    definition_xml,
    {
      # We don't want examples and notes
      no_notes_examples: true,
      reference_anchor: reference_anchor
    }
  )

  return nil if converted_definition.nil? || converted_definition.strip.empty?

  if definition_xml.name == 'ext_description'
    converted_definition = "      \#{converted_definition}\n\n      NOTE: This term is incompletely defined in this document.\n      Reference <<\#{reference_anchor}>> for the complete definition.\n    TEXT\n  end\n  new(\n    converted_definition: converted_definition,\n    reference_anchor: reference_anchor,\n    reference_clause: reference_clause,\n    file_path: file_path\n  )\nend\n"

Instance Method Details

#to_mn_adocObject



51
52
53
54
55
56
57
58
59
60
# File 'lib/stepmod/utils/concept.rb', line 51

def to_mn_adoc
  "    // STEPmod path:\#{!file_path.empty? ? \" \#{file_path}\" : \"\"}\n    \#{converted_definition}\n\n    [.source]\n    <<\#{reference_anchor}\#{reference_clause ? \",clause=\" + reference_clause : \"\"}>>\n\n  TEXT\nend\n"