Skip to content

Example: Packages

Andrias Meisyal edited this page Jul 16, 2017 · 4 revisions

A package is a collection of classes. For example,

Package

If you generate Ruby code of class diagram above, this extension will convert the package as a Ruby module. Ruby module is a folder which has a name. The folder name refers to package name. So, you will have geometry folder that contains Ruby code of Circle and Square classes.

geometry/circle.rb

module Geometry
  class Circle
    def initialize()
    end

    def to_s
      "Your string representation of the object will be written here."
    end
  end
end

geometry/square.rb

module Geometry
  class Square
    def initialize()
    end

    def to_s
      "Your string representation of the object will be written here."
    end
  end
end

This example uses default configuration of the extension

Clone this wiki locally