Class: SpotFlow::Bpmn::Definitions
- Inherits:
-
Object
- Object
- SpotFlow::Bpmn::Definitions
- Includes:
- ActiveModel::Model
- Defined in:
- lib/spot_flow/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
Returns a new instance of Definitions.
25 26 27 28 29 30 31 32 |
# File 'lib/spot_flow/bpmn/definitions.rb', line 25 def initialize(attributes={}) super(attributes.except(:message, :signal, :error, :process)) @messages = 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.
9 10 11 |
# File 'lib/spot_flow/bpmn/definitions.rb', line 9 def errors @errors end |
#execution_platform ⇒ Object
Returns the value of attribute execution_platform.
8 9 10 |
# File 'lib/spot_flow/bpmn/definitions.rb', line 8 def execution_platform @execution_platform end |
#execution_platform_version ⇒ Object
Returns the value of attribute execution_platform_version.
8 9 10 |
# File 'lib/spot_flow/bpmn/definitions.rb', line 8 def execution_platform_version @execution_platform_version end |
#exporter ⇒ Object
Returns the value of attribute exporter.
8 9 10 |
# File 'lib/spot_flow/bpmn/definitions.rb', line 8 def exporter @exporter end |
#exporter_version ⇒ Object
Returns the value of attribute exporter_version.
8 9 10 |
# File 'lib/spot_flow/bpmn/definitions.rb', line 8 def exporter_version @exporter_version end |
#id ⇒ Object
Returns the value of attribute id.
8 9 10 |
# File 'lib/spot_flow/bpmn/definitions.rb', line 8 def id @id end |
#messages ⇒ Object (readonly)
Returns the value of attribute messages.
9 10 11 |
# File 'lib/spot_flow/bpmn/definitions.rb', line 9 def @messages end |
#name ⇒ Object
Returns the value of attribute name.
8 9 10 |
# File 'lib/spot_flow/bpmn/definitions.rb', line 8 def name @name end |
#processes ⇒ Object (readonly)
Returns the value of attribute processes.
9 10 11 |
# File 'lib/spot_flow/bpmn/definitions.rb', line 9 def processes @processes end |
#signals ⇒ Object (readonly)
Returns the value of attribute signals.
9 10 11 |
# File 'lib/spot_flow/bpmn/definitions.rb', line 9 def signals @signals end |
#target_namespace ⇒ Object
Returns the value of attribute target_namespace.
8 9 10 |
# File 'lib/spot_flow/bpmn/definitions.rb', line 8 def target_namespace @target_namespace end |
Class Method Details
.from_xml(xml) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/spot_flow/bpmn/definitions.rb', line 11 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
42 43 44 |
# File 'lib/spot_flow/bpmn/definitions.rb', line 42 def error_by_id(id) errors.find { |error| error.id == id } end |
#inspect ⇒ Object
50 51 52 |
# File 'lib/spot_flow/bpmn/definitions.rb', line 50 def inspect "#<Bpmn::Definitions @id=#{id.inspect} @name=#{name.inspect} @messages=#{.inspect} @signals=#{signals.inspect} @errors=#{errors.inspect} @processes=#{processes.inspect}>" end |
#message_by_id(id) ⇒ Object
34 35 36 |
# File 'lib/spot_flow/bpmn/definitions.rb', line 34 def (id) .find { || .id == id } end |
#process_by_id(id) ⇒ Object
46 47 48 |
# File 'lib/spot_flow/bpmn/definitions.rb', line 46 def process_by_id(id) processes.find { |process| process.id == id } end |
#signal_by_id(id) ⇒ Object
38 39 40 |
# File 'lib/spot_flow/bpmn/definitions.rb', line 38 def signal_by_id(id) signals.find { |signal| signal.id == id } end |