Sha256: e54550795fe1c7f788da2787900f9809b84f344e947399c5e68523ad4cd78806

Contents?: true

Size: 537 Bytes

Versions: 1

Compression:

Stored size: 537 Bytes

Contents

# in Fancy we use the BlockEnvironment as Block
Block = Rubinius::BlockEnvironment

class Block
  # call without arguments
  alias_method :":call", :call

  define_method("call:") do |args|
    unless args.is_a? Array
      raise ArgumentError, "Expecting Array of arguments for Block"
    end
    if args.size < self.arity
      raise ArgumentError, "Too few arguments for block: #{args.size} - Minimum of #{self.arity} expected"
    else
      args = args.first(self.arity) if args.size > self.arity
      call *args
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fancy-0.3.3 boot/fancy_ext/block_env.rb