Class: Rumbly::Diagram::Base
- Inherits:
-
Object
- Object
- Rumbly::Diagram::Base
- Defined in:
- lib/rumbly/diagram/base.rb
Overview
This is an abstract class that defines the API for creating UML class diagrams. Implementations for specific formats (e.g. Yumly, Graphviz, text, etc.) should subclass this class and implement the following methods: setup
, process_klass
, middle
, process_relationship
, and finish
.
Instance Attribute Summary collapse
-
#application ⇒ Object
readonly
Returns the value of attribute application.
Class Method Summary collapse
-
.create(application) ⇒ Object
Creates a specific subclass of this base diagram class based on the diagram type specific in the global options, then calls its
#build
method to create and save the UML class diagram.
Instance Method Summary collapse
-
#build ⇒ Object
Builds a UML class diagram via the callbacks defined for this base class.
-
#initialize(application) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(application) ⇒ Base
Returns a new instance of Base.
27 28 29 |
# File 'lib/rumbly/diagram/base.rb', line 27 def initialize (application) @application = application end |
Instance Attribute Details
#application ⇒ Object (readonly)
Returns the value of attribute application.
25 26 27 |
# File 'lib/rumbly/diagram/base.rb', line 25 def application @application end |
Class Method Details
.create(application) ⇒ Object
Creates a specific subclass of this base diagram class based on the diagram type specific in the global options, then calls its #build
method to create and save the UML class diagram.
17 18 19 20 21 |
# File 'lib/rumbly/diagram/base.rb', line 17 def create (application) diagram_type = Rumbly::.diagram.type require "rumbly/diagram/#{diagram_type}" Rumbly::Diagram.const_get(diagram_type.to_s.classify).new(application).build end |
Instance Method Details
#build ⇒ Object
Builds a UML class diagram via the callbacks defined for this base class.
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/rumbly/diagram/base.rb', line 32 def build setup @application.klasses.each do |klass| process_klass(klass) end middle @application.relationships.each do |relationship| process_relationship(relationship) end finish end |