Comprehensive negation for all Ruby predicate methods. No more !array.empty? Now write array.not_empty?
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
spec
.gitignore
LICENSE
README.rdoc
Rakefile
init.rb
next_gem_version

README.rdoc

WhyNot?

not_empty?, not_blank?, … why_not? Tired of writing !array.empty? Ruby is ledgible and should be more ledgible. Ruby is terse and should be terser. A predicate method is one that returns a boolean and ends in a question mark. This simple library adds corresponding negation methods for all Ruby predicate methods.

Resources

Install

  • sudo gem install why_not

Use

  • require 'why_not'

Usage

In general

array = %w(one two three)
array.empty?  # => false
array.not_empty? # => true

value = nil
value.nil? # => true
value.not_nil? # => false

[].is_not_a?(Array) # => false
[].isnt_a?(String) # => true

Dependencies

  • rubygems

  • meta_programming