Open eregon opened 5 years ago
can you make a PR on the vertx-web-site repo with these improvements ?
For the ()
, fixing it in the documentation would be indeed enough, but for replacing $vertx
by VertX
, I would guess one would need to modify how the Ruby part of Vert.x is initialized, unless there is already a Vertx
or VertX
constant?
that makes sense to me.
verticles have access to $vertx for the vertx instance: see https://vertx.io/docs/vertx-core/ruby/#_writing_verticles https://vertx.io/docs/vertx-core/ruby/#_writing_verticles
should it changed to something else to be more idiomatic ?
On 23 Jul 2019, at 20:39, Benoit Daloze notifications@github.com wrote:
For the (), fixing it in the documentation would be indeed enough, but for replacing $vertx by VertX, I would guess one would need to modify how the Ruby part of Vert.x is initialized, unless there is already a Vertx or VertX constant?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/vert-x3/vertx-lang-ruby/issues/41?email_source=notifications&email_token=AABXDCTOI4TLQH36AIDXNK3QA5F7TA5CNFSM4IGGBHFKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2UBRKY#issuecomment-514332843, or mute the thread https://github.com/notifications/unsubscribe-auth/AABXDCR5ZKDL7EVBUXYXDRDQA5F7TANCNFSM4IGGBHFA.
should it changed to something else to be more idiomatic ?
I guess it's direct translation of the vertx
global variable from JavaScript.
I think a constant would be more idiomatic, if the value never changes for the whole program.
However, Vertx
seems already used as a module.
Vertx::Vertx.vertx
seems to currently be the same as $vertx
, but that's very long.
Maybe VertX
(but it's quite subtle about the case) or Vert.x
(a method call x
on a Vert
constant)?
Example from https://vertx.io/:
Global variables like
$vertx
are basically discouraged and deprecated (https://github.com/rubocop-hq/ruby-style-guide#instance-vars). Global functionality is idiomatically stored inConstants
likeVertx
orVertX
.Using
()
after a method call is not idiomatic Ruby (https://github.com/rubocop-hq/ruby-style-guide#method-calls-with-no-arguments).With that, the code looks like this:
Which already feels much closer to idiomatic Ruby code.