Skip to content

Commit 0766985

Browse files
committed
Merge branch 'release-0.1.9'
2 parents 38b2c85 + dfe2f8e commit 0766985

File tree

8 files changed

+635
-3636
lines changed

8 files changed

+635
-3636
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ terms of the [MIT License][license].
3636

3737
[issuetracker]: https://github.com/meisyal/staruml-ruby/issues
3838
[staruml]: http://staruml.io
39-
[starumldev]: https://github.com/staruml/staruml-dev-docs/wiki
40-
[starumlapi]: http://starumldocs-7a0.kxcdn.com/2.0.0/api
39+
[starumldev]: https://docs.staruml.io/developing-extensions/getting-started
40+
[starumlapi]: http://staruml.io/reference/3.1.0/api
4141
[license]: https://github.com/meisyal/staruml-ruby/blob/master/LICENSE

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2016-2018 Andrias Meisyal
3+
Copyright (c) 2016-2019 Andrias Meisyal
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ staruml-ruby is a Ruby extension for [StarUML][staruml]. This extension helps
44
you to generate Ruby code from a UML class diagram. For example, you have a
55
class called `Book`.
66

7-
![Book class](https://res.cloudinary.com/daokp8cnd/image/upload/v1540477871/staruml-ruby/book-class.png)
7+
![Book class](https://res.cloudinary.com/daokp8cnd/image/upload/c_scale,w_155/v1540477871/staruml-ruby/book-class.png)
88

99
staruml-ruby will generate code below:
1010

@@ -87,7 +87,7 @@ take a moment to look over the [contributing guidelines][contributing] first.
8787
This extension is released under the terms of MIT License. See the
8888
[LICENSE][license] file for more details.
8989

90-
Copyright © 2016-2018 Andrias Meisyal.
90+
Copyright © 2016-2019 Andrias Meisyal.
9191

9292

9393

code-generator-utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016-2018 Andrias Meisyal. All rights reserved.
2+
* Copyright (c) 2016-2019 Andrias Meisyal. All rights reserved.
33
*
44
* Permission is hereby granted, free of charge, to any person obtaining a
55
* copy of this software and associated documentation files (the "Software"),

main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016-2018 Andrias Meisyal. All rights reserved.
2+
* Copyright (c) 2016-2019 Andrias Meisyal. All rights reserved.
33
*
44
* Permission is hereby granted, free of charge, to any person obtaining a
55
* copy of this software and associated documentation files (the "Software"),

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"homepage": "https://github.com/meisyal/staruml-ruby",
66
"issues": "https://github.com/meisyal/staruml-ruby/issues",
77
"keywords": ["ruby"],
8-
"version": "0.1.8",
8+
"version": "0.1.9",
99
"author": {
1010
"name": "Andrias Meisyal",
1111
"email": "andriasonline@gmail.com",

ruby-code-generator.js

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016-2018 Andrias Meisyal. All rights reserved.
2+
* Copyright (c) 2016-2019 Andrias Meisyal. All rights reserved.
33
*
44
* Permission is hereby granted, free of charge, to any person obtaining a
55
* copy of this software and associated documentation files (the "Software"),
@@ -230,31 +230,23 @@ class RubyCodeGenerator {
230230

231231
for (var i = 0; i < associations.length; i++) {
232232
var association = associations[i]
233+
var packageName
234+
var fileName
233235

234236
if (association.end1.reference === element && association.end2.navigable === true) {
235-
var packageName = codeWriter.getFileName(this.getPackageName(association.end2.reference))
236-
var fileName = codeWriter.getFileName(association.end2.reference.name)
237-
238-
if (packageName) {
239-
codeWriter.writeLine('require_relative \'' + packageName + '/' + fileName + '.rb\'')
240-
} else if (isInModule) {
241-
codeWriter.writeLine('require_relative \'../' + fileName + '.rb\'')
242-
} else {
243-
codeWriter.writeLine('require_relative \'' + fileName + '.rb\'')
244-
}
237+
packageName = codeWriter.getFileName(this.getPackageName(association.end2.reference))
238+
fileName = codeWriter.getFileName(association.end2.reference.name)
239+
} else if (association.end2.reference === element && association.end1.navigable === true) {
240+
packageName = codeWriter.getFileName(this.getPackageName(association.end1.reference))
241+
fileName = codeWriter.getFileName(association.end1.reference.name)
245242
}
246243

247-
if (association.end2.reference === element && association.end1.navigable === true) {
248-
var packageName = codeWriter.getFileName(this.getPackageName(association.end1.reference))
249-
var fileName = codeWriter.getFileName(association.end1.reference.name)
250-
251-
if (packageName) {
252-
codeWriter.writeLine('require_relative \'' + packageName + '/' + fileName + '.rb\'')
253-
} else if (isInModule) {
254-
codeWriter.writeLine('require_relative \'../' + fileName + '.rb\'')
255-
} else {
256-
codeWriter.writeLine('require_relative \'' + fileName + '.rb\'')
257-
}
244+
if (packageName) {
245+
codeWriter.writeLine('require_relative \'' + packageName + '/' + fileName + '.rb\'')
246+
} else if (isInModule) {
247+
codeWriter.writeLine('require_relative \'../' + fileName + '.rb\'')
248+
} else {
249+
codeWriter.writeLine('require_relative \'' + fileName + '.rb\'')
258250
}
259251
}
260252

@@ -299,6 +291,12 @@ class RubyCodeGenerator {
299291
for (var i = 0; i < len; i++) {
300292
if (!element.attributes[i].isStatic) {
301293
terms.push(element.attributes[i].name)
294+
295+
if (element.attributes[i].defaultValue) {
296+
terms.push('=')
297+
terms.push(element.attributes[i].defaultValue)
298+
}
299+
302300
terms.push(', ')
303301
}
304302
}

0 commit comments

Comments
 (0)