Small, focused, awesome methods added to core Ruby classes. Home of the endlessly useful nil_chain.
MIT License
Ruby includes a huge amount of default awesomeness that tackles most common development challenges. But every now and then, you find yourself performing contortions to achieve results that, honestly, should feel more natural given the language's design elegance. Finishing Moves is a collection of methods designed to assist in those "why is this awkward?" scenarios.
In the right situation, they kick serious cyclomatic butt.
Gemfile
gem 'finishing_moves'
Command line
gem install 'finishing_moves'
Not sure if this gem is for you? Check out the methods marked with a ๐ฅ first.
Array#to_hash_values
๐ฅArray#to_indexed_hash
Array#to_hash_keys
Array#to_sym_strict
Array#to_sym_loose
Enumerable#key_map
๐ฅEnumerable#key_map_reduce
Hash#delete!
Hash#delete_each
Hash#delete_each!
Integer#length
Kernel#nil_chain
๐ฅ๐ฅKernel#bool_chain
Kernel#silently
Kernel#cascade
Kernel#class_exists?
Numeric#add_percent
Numeric#subtract_percent
Object#same_as
Object#not_nil?
Object#numeric?
๐ฅObject#is_an?
Object#is_not_a?
Object#is_one_of?
๐ฅObject#true?
Object#false?
Object#bool?
Object#true_?
Object#false_?
String#dedupe
String#keyify
String#slugify
String#match?
String#nl2br
String#newline_to
String#remove_whitespace
String#replace_whitespace
String#strip_all
๐ฅString#to_uuid
Tested against all supported versions of official RVM, currently 2.7.6
and above.
Drop us a line in the issues section.
Be sure to include sample code that reproduces the problem.