Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Get wrapper for inverted comparisons.
Ruby
tree: 7503298d22

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
.gitignore
History.rdoc
LICENSE
Manifest.txt
README.rdoc
Rakefile
example.rb

README.rdoc

vertere

code

github.com/kachick/vertere

gem

rubygems.org/gems/vertere

Description

Provide a wrapper class for inverted comparisons

Features

Wrap below methods

  • #==

  • #===

  • #=~

  • #<=>

Usage

  • Setup

    require 'vertere'
  • An approaching to invert comparisons # from [ruby-talk:392128]

    NUMBER_CHARS = ["0", "1", "9", "10", "11"]
    NUMBER_CHARS.grep(/0/)                  #=> ["0", "10"]
    NUMBER_CHARS.grep(Veretere.invert(/0/)) #=> ["1", "9", "11"]
  • Extend Ruby's interface

    require 'vertere/ext'
    
    NUMBER_CHARS.grep(/0/.for_!)            #=> ["1", "9", "11"]
  • And more

    NUMBER_CHARS.sort_by{|s|s.to_i.for_!}  #=> ["11", "10", "9", "1", "0"]

Requirements

  • Ruby 1.9.2 or later

    Focusing

    • 1.9.3-p194

    • 1.9.2-p290

Installation

  • gem install vertere

License

The MIT X11 License

Copyright © 2012 Kenichi Kamiya

See the file LICENSE for further details.

Something went wrong with that request. Please try again.