jashkenas / ruby-processing

Code as Art, Art as Code. Processing and Ruby are meant for each other.
http://github.com/jashkenas/ruby-processing/wikis
Other
1.28k stars 94 forks source link

shape gives wrong # of arguments #16

Closed fjenett closed 14 years ago

fjenett commented 14 years ago

calling shape with 3 arguments (PShape, int, int) in 1.0.9 gives:

`shape': wrong # of arguments(3 for 1) (ArgumentError)

this is new and used to work back in vers. 1.0.6

jashkenas commented 14 years ago

We had a version of the shape method that took a block, but it was conflicting with the newer Processing method of the same name. I've removed it on master, so that API's should be back to parity.

fjenett commented 14 years ago

this works for me ...

# Shortcut for begin_shape/end_shape pair
alias original_shape shape
def shape ( *args )
    if (args.length == 1) && (args.first.kind_of? Numeric)
        begin_shape args.first
            yield
        end_shape
    else
        original_shape( *args )
    end
end