Class: Camunda::BpmnXML

Inherits:
Object
  • Object
show all
Defined in:
lib/camunda/bpmn_xml.rb

Defined Under Namespace

Classes: Task

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(io_or_string) ⇒ BpmnXML

Returns a new instance of BpmnXML.



3
4
5
# File 'lib/camunda/bpmn_xml.rb', line 3

def initialize(io_or_string)
  @doc = Nokogiri::XML(io_or_string)
end

Instance Attribute Details

#docObject (readonly)

Returns the value of attribute doc.



2
3
4
# File 'lib/camunda/bpmn_xml.rb', line 2

def doc
  @doc
end

Instance Method Details

#class_names_with_same_bpmn_id_as_topicObject



21
22
23
# File 'lib/camunda/bpmn_xml.rb', line 21

def class_names_with_same_bpmn_id_as_topic
  tasks_with_same_bpmn_id_as_topic.map(&:class_name)
end

#external_tasksObject



15
16
17
18
19
# File 'lib/camunda/bpmn_xml.rb', line 15

def external_tasks
  @doc.xpath('//*[@camunda:type="external"]').map do |task|
    Task.new(task)
  end
end

#modularized_class_namesObject



25
26
27
# File 'lib/camunda/bpmn_xml.rb', line 25

def modularized_class_names
  class_names_with_same_bpmn_id_as_topic.map { |name| "#{module_name}::#{name}" }
end

#module_nameObject



11
12
13
# File 'lib/camunda/bpmn_xml.rb', line 11

def module_name
  @doc.xpath('/bpmn:definitions/bpmn:process').first['id']
end

#to_sObject



7
8
9
# File 'lib/camunda/bpmn_xml.rb', line 7

def to_s
  module_name
end

#topicsObject



29
30
31
# File 'lib/camunda/bpmn_xml.rb', line 29

def topics
  @doc.xpath('//*[@camunda:topic]').map { |node| node.attribute('topic').value }.uniq
end