Top Level Namespace

Defined Under Namespace

Modules: Enumerable, Lab42 Classes: Array, Dir, File, Hash, Module, Object, OpenObject

Instance Method Summary collapse

Instance Method Details

#_realize_args_(para, args) ⇒ Object

module Lab42



6
7
8
# File 'lib/lab42/core/console_tools/func.rb', line 6

def _realize_args_ para, args
  args.map{ |arg| Proc === arg ? arg.(para) :arg }
end

#_transform_for_f_(args) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/lab42/core/console_tools/func.rb', line 10

def _transform_for_f_ args
  args.map do | arg |
    case arg
    when Array
      f *arg
    else
      arg
    end
  end
end

#B(*a, &b) ⇒ Object



3
4
5
# File 'lib/lab42/core/b.rb', line 3

def B *a, &b
  Lab42::Meta::Behavior *a, &b
end

#f(*args) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/lab42/core/console_tools/func.rb', line 21

def f *args
  args = _transform_for_f_ args
  # At this level we need to see if there is a Lab42::Receiver
  if Symbol === args.first
    -> r do
      r.send *_realize_args_( r, args )
    end
  else
    -> *r do
      args.first.send *_realize_args_( r.first, args.drop(1) )
    end
  end
end