Interrogate attempts to bring Scheme-like class predication to Ruby.
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
spec
.gitignore
.travis.yml
Gemfile
MIT-LICENSE
README.md
Rakefile
interrogate.gemspec

README.md

Interrogate Build Status

Interrogate attempts to bring Scheme-like class predication to Ruby. It provides an alternate syntax using Module#===.

>> require "interrogate"
>> String?("Hello")
>> trues
>> Symbol?(:World)
>> true
>> Float?(1.0)
>> true

You can "interrogate" multiple objects as well:

>> String?("Hello", :World, 1.0)
>> false
>> String?("Hello", "World", "1.0")
>> true

And you can "interrogate" the return value of a block:

>> num = 1
>> String?("Hello") { num }
>> false
>> String?("Hello") { num.to_s }
>> true

Feedback

Use that Github issue tracker!