Symbol Lookup Gem
A gemified version of the Symbol[str] method proposed in https://bugs.ruby-lang.org/issues/7854
call-seq:
Symbol.find str => Symbol or nil
Symbol[str] => Symbol or nil
str.interned? => Symbol or nil
str.to_existing_sym => Symbol or ArgumentError
Returns an extant symbol, which is the .to_sym of str, or
nil if no such symbol exists.
Symbol.find 'Object' #=> :Object
Symbol.find 'none such' #=> nil
Symbol['Object'] #=> :Object
Symbol['none such'] #=> nil
'Object'.interned? #=> :Object
'none such'.interned? #=> nil
'Object'.to_existing_sym #=> :Object
'none such'.to_existing_sym #=> (raises ArgumentError)Contributing
We require all contributors to comply with the Developer Certificate of Origin. This ensures that all contributions are properly licensed and attributed.
Contributor Code of Conduct
This repository is subject to a Contributor Code of Conduct adapted from the Contributor Covenant, version 3.0, available at https://www.contributor-covenant.org/version/3/0/
Licence
This project is licensed under the ISC licence. See LICENSE for details