Re: enums 1.0 library / gem - safe enumeration types for ruby e.g. enum :Color, [:red, :green, :blue]

RRRoy BBBean <[email protected]>
Newsgroups gmane.comp.lang.ruby.general
Message-ID <[email protected]>
I understand now. It really doesn't make sense to explicitly assign 
integer values. Thank you.

Is this a gem that I can download and install using gem?

On 3/6/19 12:47 PM, Gerald Bauer wrote:
> Hello,
>
>       Sorry for the late reply I was offline over the weekend in Venice
> at the Carne Vale!
>
>> This looks really neat. Does it have any runtime dependencies?
>     Thanks for your kind words.
>     No. The enums library has NO dependencies other than ruby and the
> standard library itself.
>
>> Is it possible to assign a specific integer values to a symbol? For some
>> symbols? Or perhaps all or no symbols?
>      For now the enum is "immutable" and starts counting at zero for
> the first member.
> The enum for now follows the enum data type in solidity [1] because
> that's the first use case in (secure) ruby
> and why it was created in the first place :-).
>
>        If there's really a need to assign specific integers and if you
> have some great examples, for sure, it's possible to add in a future
> update e.g. using
>
> Enum.new( 'Color', red: 0, green: 1, blue: 2 )
>
>     instead of
>
> Enum.new( 'Color', :red, :green, :blue )
>
>
>     Cheers. Prost.
>
> [1]  https://solidity.readthedocs.io/en/latest/types.html#enums
>
> Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>

Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.