Class: Proc

### Home Classes Methods

### In Files

- lib/backports/1.9.1/proc/case_compare.rb
- lib/backports/1.9.1/proc/curry.rb
- lib/backports/1.9.1/proc/lambda.rb

### Parent

Object

### Methods

- #curry
- #lambda?

### Class/Module Index

Quicksearch

- Prime
- Prime::EratosthenesGenerator
- Prime::EratosthenesSieve
- Prime::Generator23
- Prime::OldCompatibility
- Prime::PseudoPrimeGenerator
- Prime::TrialDivision
- Prime::TrialDivisionGenerator
- Backports
- Backports::MOST_EXTREME_OBJECT_EVER
- Backports::StdLib
- Backports::StdLib::LoadedFeatures
- Enumerator
- Enumerator::GeneratorBP
- Enumerator::Lazy
- Enumerator::Yielder
- Matrix
- Matrix::EigenvalueDecomposition
- Matrix::LUPDecomposition
- Random
- Random::Implementation
- Random::MT19937
- Enumerable
- Enumerable::Enumerator
- File
- File::Constants
- ARGF
- Array
- BasicObject
- Binding
- Complex
- Dir
- ENV
- Fixnum
- Float
- GC
- Hash
- IO
- Integer
- Kernel
- Math
- Method
- Module
- NilClass
- Numeric
- Object
- ObjectSpace
- OpenStruct
- Proc
- Process
- Range
- Regexp
- Set
- StopIteration
- String
- Struct
- Symbol
- UnboundMethod

No matching classes.

# Proc

### Public Instance Methods

curry(argc = nil) click to toggle source

    # File lib/backports/1.9.1/proc/curry.rb, line 5
    def curry(argc = nil)
      min_argc = arity < 0 ? -arity - 1 : arity
      argc ||= min_argc
      if lambda? and arity < 0 ? argc < min_argc : argc != arity
        raise ArgumentError, "wrong number of arguments (#{argc} for #{min_argc})"
      end
      creator = lambda? ? :lambda : :proc
      block = send(creator) do |*args|
        if args.size >= argc
          call(*args)
        else
          send(creator) do |*more_args|
            args += more_args
            block.call(*args)
          end
        end
      end
    end

lambda?() click to toggle source

Standard in Ruby 1.9. See official documentation

    # File lib/backports/1.9.1/proc/lambda.rb, line 6
    def lambda?
      !!__is_lambda__
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.