Re: enums 1.0 library / gem - safe enumeration types for ruby e.g. enum :Color, [:red, :green, :blue]
Gerald Bauer <[email protected]>
| Newsgroups | gmane.comp.lang.ruby.general |
|---|---|
| Message-ID | <CAAxEZd9tux+4BGMcimJ1MNrVLghR2F-PtKmQtrFP_bFjwvXS5w@mail.gmail.com> |
Hello, > Is this a gem that I can download and install using gem? Yes, it's a regular "plain vanilla" gem. No dependencies. It's just ruby. To install use: $ gem install enums See https://rubygems.org/gems/enums for official gem page. Cheers. Prost. PS: Note: For now everything is in the Safe namespace / module. Try: require 'enums' module Safe Enum.new( :Color, :red, :blue, :green) end pp Safe::Color.values pp Safe::Color.keys etc. Unsubscribe: <mailto:[email protected]?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>