Created
January 22, 2013 05:26
-
-
Save tatey/4592323 to your computer and use it in GitHub Desktop.
Typically we'd use hashes for this sort of things, but unlike hashes, going ChoiceTypes.doesnt_exist will raise an exception instead of returning nil.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Known poll types. Unknown types will raise | |
| # an exception. | |
| # | |
| # Poll::ChoiceTypes.time # => 'Choice::Time' | |
| # | |
| # @return [Struct] | |
| ChoiceTypes = Struct.new(:time, :place, :text).new.tap do |types| | |
| types.time = 'Choice::Time' | |
| types.place = 'Choice::Place' | |
| types.text = 'Choice::Text' | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment