github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

jicksta / superators

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 5
    • 0
  • Source
  • Commits
  • Network (0)
  • Issues (0)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (0)
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

Superators add new operators to Ruby — Read more

  cancel

http://jicksta.com

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Moving Superators from RubyForge SVN to Github 
Jay Phillips (author)
Tue Mar 18 12:37:37 -0700 2008
commit  735d579010c34ac495e97729efc7c7b296e44a48
tree    e4d91041a457c7df68c6f172272d88d78ac4d1fe
superators /
name age
history
message
file History.txt Loading commit data...
file Manifest.txt
file README.txt
file Rakefile
directory bin/
directory lib/
directory spec/
README.txt
superators
    by Jay Phillips
    http://jicksta.com

== DESCRIPTION:
  
Superators are a superset of new Ruby operators you can create and use.

== FEATURES/PROBLEMS:
  
* Presently a superator operand must support having a singleton class. Because true, false, nil, Symbols, and Fixnums 
are all specially optimized for in MRI and cannot have singleton classes, they can't be given to a superator. There are 
ways this can be potentially accounted for, but nothing is in place at the moment, causing this to be classified as a 
bug.

* When defining a superator in a class, any operators overloaded after the superator definition will override a 
superator definition. For example, if you create the superator "<---" and then define the <() operator, the superator 
will not work. In this case, the superator's definition should be somewhere after the <() definition.

* Superators work by handling a binary Ruby operator specially and then building a chain of unary operators after it. 
For this reason, a superator must match the regexp 
/^(\*\*|\*|\/|%|\+|\-|<<|>>|&|\||\^|<=>|>=|<=|<|>|===|==|=~)(\-|~|\+)+$/.

== SYNOPSIS:

Below is a simple example monkey patch which adds the "<---" operator to all Ruby Arrays.

  class Array
    superator "<---" do |operand|
      if operand.kind_of? Array
        self + operand.map { |x| x.inspect }
      else
        operand.inspect
      end
    end
  end

== REQUIREMENTS:

* Only requirement is Ruby.

== INSTALL:

* sudo gem install superators
* require 'superators'

== LICENSE:

This software is licensed in the public domain. You may do whatever you wish with it.

You are allowed to use this library during dodo poaching as well.
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server