Symbol based on the given argument.
Add this line to your application's Gemfile:
And then execute:
Or install it yourself as:
gem install kernel-symbol
If the argument is a symbol, returns the symbol. If the argument is not a symbol, tries to convert to a symbol.
In all other cases, returns an error.
require "kernel/symbol" Symbol(:foo) # => :foo Symbol("foo") # => :foo Symbol(true) # => :true Symbol(42) # => :"42" Symbol(BasicObject.new) # TypeError (can't convert BasicObject into String)
#Symbol method could be used similarly to the methods already present in the
Kernel module is included in the
Object class, so by loading this library, the
#Symbol method will be available in every Ruby object.
Kernel#Symbol uses Semantic Versioning 2.0.0
kernel-boolean: Returns a
Booleanbased on the given argument.
The gem is available as open source under the terms of the MIT License.