Class: Ludy::List

Inherits:
Object
  • Object
show all
Defined in:
lib/ludy/list.rb

Overview

fib = 0 : 1 : [x+y | (x, y) <- zip fib (tail fib)] combos = List[->(x,y)</a>, 0..1, 2..3]

Class Method Summary collapse

Class Method Details

.[](target, *args) ⇒ Object

Raises:

  • (ArgumentError)


8
9
10
11
12
13
# File 'lib/ludy/list.rb', line 8

def [] target, *args
  raise ArgumentError.new("you need at least #{target.arity} arguments(sources) for #{target}") if args.size < target.arity
  sources = args[0...target.arity]
  conditions = args[target.arity..-1]
  create_array sources, conditions
end