In this PR I didn’t change stuff except the naming convention, but generally in Ruby there is no real benefit of using “enum classes” like this:
class AccessMode
None = "None"
ReadOnly = "ReadOnly"
ReadWrite = "ReadWrite"
Admin = "Admin"
end
Typically a Ruby library would simply operate on symbols (:read_only etc), and if some conversion is needed to eg. send a query to server, it would be converted to a different value using a dictionary like {read_only: “ReadOnly”, read_write: “UsedToBeReadWriteButNowIsWriteRead”, …}.
Also, and this is more troubling, there are some places that suggest that a constant is used as a variable:
if (DocumentConventions::DefaultUseOptimisticConcurrency &&
or even explicitly suggest that constant should be redefined by user:
"You can increase the limit by setting RavenDB::DocumentConventions::"\
"MAX_NUMBER_OF_REQUEST_PER_SESSION
In Ruby such use of constants is incorrect, as they should never be redefined.
In this PR I didn’t change stuff except the naming convention, but generally in Ruby there is no real benefit of using “enum classes” like this:
Typically a Ruby library would simply operate on symbols (
:read_only
etc), and if some conversion is needed to eg. send a query to server, it would be converted to a different value using a dictionary like{read_only: “ReadOnly”, read_write: “UsedToBeReadWriteButNowIsWriteRead”, …}
.Also, and this is more troubling, there are some places that suggest that a constant is used as a variable:
or even explicitly suggest that constant should be redefined by user:
In Ruby such use of constants is incorrect, as they should never be redefined.