Class: BPMN::Definitions
- Inherits:
-
Object
- Object
- BPMN::Definitions
- Includes:
- ActiveModel::Model
- Defined in:
- lib/bpmn/definitions.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#execution_platform ⇒ Object
Returns the value of attribute execution_platform.
-
#execution_platform_version ⇒ Object
Returns the value of attribute execution_platform_version.
-
#exporter ⇒ Object
Returns the value of attribute exporter.
-
#exporter_version ⇒ Object
Returns the value of attribute exporter_version.
-
#id ⇒ Object
Returns the value of attribute id.
-
#messages ⇒ Object
readonly
Returns the value of attribute messages.
-
#name ⇒ Object
Returns the value of attribute name.
-
#processes ⇒ Object
readonly
Returns the value of attribute processes.
-
#signals ⇒ Object
readonly
Returns the value of attribute signals.
-
#target_namespace ⇒ Object
Returns the value of attribute target_namespace.
Class Method Summary collapse
Instance Method Summary collapse
- #error_by_id(id) ⇒ Object
-
#initialize(attributes = {}) ⇒ Definitions
constructor
A new instance of Definitions.
- #inspect ⇒ Object
- #message_by_id(id) ⇒ Object
- #process_by_id(id) ⇒ Object
- #signal_by_id(id) ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Definitions
24 25 26 27 28 29 30 31 |
# File 'lib/bpmn/definitions.rb', line 24 def initialize(attributes={}) super(attributes.except(:message, :signal, :error, :process)) = Array.wrap(attributes[:message]).map { |atts| Message.new(atts) } @signals = Array.wrap(attributes[:signal]).map { |atts| Signal.new(atts) } @errors = Array.wrap(attributes[:error]).map { |atts| Error.new(atts) } @processes = Array.wrap(attributes[:process]).map { |atts| Process.new(atts) } end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
8 9 10 |
# File 'lib/bpmn/definitions.rb', line 8 def errors @errors end |
#execution_platform ⇒ Object
Returns the value of attribute execution_platform.
7 8 9 |
# File 'lib/bpmn/definitions.rb', line 7 def execution_platform @execution_platform end |
#execution_platform_version ⇒ Object
Returns the value of attribute execution_platform_version.
7 8 9 |
# File 'lib/bpmn/definitions.rb', line 7 def execution_platform_version @execution_platform_version end |
#exporter ⇒ Object
Returns the value of attribute exporter.
7 8 9 |
# File 'lib/bpmn/definitions.rb', line 7 def exporter @exporter end |
#exporter_version ⇒ Object
Returns the value of attribute exporter_version.
7 8 9 |
# File 'lib/bpmn/definitions.rb', line 7 def exporter_version @exporter_version end |
#id ⇒ Object
Returns the value of attribute id.
7 8 9 |
# File 'lib/bpmn/definitions.rb', line 7 def id @id end |
#messages ⇒ Object (readonly)
Returns the value of attribute messages.
8 9 10 |
# File 'lib/bpmn/definitions.rb', line 8 def end |
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/bpmn/definitions.rb', line 7 def name @name end |
#processes ⇒ Object (readonly)
Returns the value of attribute processes.
8 9 10 |
# File 'lib/bpmn/definitions.rb', line 8 def processes @processes end |
#signals ⇒ Object (readonly)
Returns the value of attribute signals.
8 9 10 |
# File 'lib/bpmn/definitions.rb', line 8 def signals @signals end |
#target_namespace ⇒ Object
Returns the value of attribute target_namespace.
7 8 9 |
# File 'lib/bpmn/definitions.rb', line 7 def target_namespace @target_namespace end |
Class Method Details
.from_xml(xml) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/bpmn/definitions.rb', line 10 def self.from_xml(xml) XmlHasher.configure do |config| config.snakecase = true config.ignore_namespaces = true config.string_keys = false end hash = XmlHasher.parse(xml) Definitions.new(hash[:definitions].except(:bpmn_diagram)).tap do |definitions| definitions.processes.each do |process| process.wire_references(definitions) end end end |
Instance Method Details
#error_by_id(id) ⇒ Object
41 42 43 |
# File 'lib/bpmn/definitions.rb', line 41 def error_by_id(id) errors.find { |error| error.id == id } end |
#inspect ⇒ Object
49 50 51 |
# File 'lib/bpmn/definitions.rb', line 49 def inspect "#<BPMN::Definitions @id=#{id.inspect} @name=#{name.inspect} @messages=#{messages.inspect} @signals=#{signals.inspect} @errors=#{errors.inspect} @processes=#{processes.inspect}>" end |
#message_by_id(id) ⇒ Object
33 34 35 |
# File 'lib/bpmn/definitions.rb', line 33 def (id) .find { || .id == id } end |
#process_by_id(id) ⇒ Object
45 46 47 |
# File 'lib/bpmn/definitions.rb', line 45 def process_by_id(id) processes.find { |process| process.id == id } end |
#signal_by_id(id) ⇒ Object
37 38 39 |
# File 'lib/bpmn/definitions.rb', line 37 def signal_by_id(id) signals.find { |signal| signal.id == id } end |