Class: Phenomenal::Viewer::Textual
- Inherits:
-
Object
- Object
- Phenomenal::Viewer::Textual
- Defined in:
- lib/phenomenal/viewer/textual.rb
Overview
Define the way to generate a textual representation of the system
Instance Attribute Summary collapse
-
#manager ⇒ Object
readonly
Returns the value of attribute manager.
-
#rmanager ⇒ Object
readonly
Returns the value of attribute rmanager.
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize ⇒ Textual
constructor
A new instance of Textual.
Constructor Details
#initialize ⇒ Textual
Returns a new instance of Textual.
5 6 7 8 |
# File 'lib/phenomenal/viewer/textual.rb', line 5 def initialize() @manager=Phenomenal::Manager.instance @rmanager=Phenomenal::RelationshipManager.instance end |
Instance Attribute Details
#manager ⇒ Object (readonly)
Returns the value of attribute manager.
3 4 5 |
# File 'lib/phenomenal/viewer/textual.rb', line 3 def manager @manager end |
#rmanager ⇒ Object (readonly)
Returns the value of attribute rmanager.
3 4 5 |
# File 'lib/phenomenal/viewer/textual.rb', line 3 def rmanager @rmanager end |
Instance Method Details
#generate ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/phenomenal/viewer/textual.rb', line 10 def generate() str="" offset=" " self.manager.contexts.each do |key,context| if context.is_a?(Phenomenal::Feature) type="Feature" str=str+"#{type}: #{context.to_s} \n" context.relationships.each do |relationship| if relationship.is_a?(Phenomenal::Implication) relation="=>" elsif relationship.is_a?(Phenomenal::Suggestion) relation="->" elsif relationship.is_a?(Phenomenal::Requirement) relation="=<" else relation="??" end str=str+"#{offset} #{relationship.source.to_s} #{relation} #{relationship.target.to_s} \n" end else type="Context" str=str+"#{type}: #{context.to_s} \n" end end str end |