Skip to content

Class association and navigability

Kevin Boice edited this page Mar 22, 2014 · 4 revisions

UML diagram

Papyrus Nodes and Edges used

association_edges

Specify association properties

  1. Select an association
  2. Specify navigability by choosing 'Navigable - True' and 'Owner - Classifier'
  • Only associations with 'Navigable' set to True and 'Owner' set to 'Classifier' will generate Ruby - Draws an arrow association_navigable
  1. To specify the visibility (scope) of a property (variable) select the property from the model explorer
    association_model_explorer
  2. Select the desired visibility (public/private/protected) association_attribute_modification

Sample Ruby output

Class1.rb

require_relative '../autogen/Class3.rb'

require_relative '../autogen/Class2.rb'

class Class1

  public
  def initialize
    @class2 = Class2.new
    @class3 = Class3.new
  
  end

  protected
  attr_accessor :class3
  
  private
  attr_accessor :class2
  
end
Class2.rb

require_relative '../autogen/Class3.rb'

class Class2

  public
  def initialize
    @class3 = Class3.new
  
  end

  protected

  private
  attr_accessor :class3
  
end
Class3.rb

class Class3

  public
  def initialize
  
  end

  
  

  protected
  
  

  private
  
  
end

Quick links