Class EDI::Diagram::Diagram
In: lib/edi4r/diagrams.rb
Parent: Object

Diagram: A structure class to represent a message diagram (branching diagram)

A Diagram is essentially

  • a Branch object (at top-level)
  • a description text
  • a node dictionary (a hash that allows index-like access)

In contrast to a simple Branch, all nodes of a Diagram object are indexed (counting from 1) according to their natural sequence in the EDIFACT branching diagram. Thus, access by index is available for Diagram objects, but not for Branch objects.

Methods

[]   branch   caching?   caching_off   caching_on   create   dir   each   flush_cache  

Public Class methods

Tells if caching is currently activated (returns a boolean)

A Diagram can become quite complex and memory-consuming. Therefore diagrams are cached after creation, so that they need to be created and maintained only once when there are several messages of the same type in an interchange.

Turns off this caching mechanism, saving memory but costing time.

Turns on caching (default setting), saving time but costing memory.

Creates (and caches) a new diagram. Returns reference to existing diagram when already in cache.

std:The syntax standard key. Currently supported:
  • ‘E’ (EDIFACT),
  • ‘I’ (SAP IDOC)
params:A hash of parameters that uniquely identify the selected diagram. Internal use only - see source code for details.

Releases memory by flushing the cache. Needed primarily for unit tests, where many if not all available diagrams are created.

Public Instance methods

Index access through ordinal number of node, starting with 1 (!).

Returns the top branch of the diagram.

Getter for the directory object associated with this diagram.

Iterates recursively through all nodes of the diagram.

[Validate]