Module: L43Rmap::Functions::Predefined

Extended by:
Evaluator::Evaluations
Defined in:
lib/l43_rmap/functions/predefined.rb,
lib/l43_rmap/functions/predefined/str.rb,
lib/l43_rmap/functions/predefined/files.rb,
lib/l43_rmap/functions/predefined/shell.rb

Defined Under Namespace

Modules: Files, Shell, Str

Class Method Summary collapse

Methods included from Evaluator::Evaluations

evaluate

Class Method Details

.if_fn(_rt, cond, true_branch, false_branch = nil) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/l43_rmap/functions/predefined.rb', line 13

def if_fn(_rt, cond, true_branch, false_branch=nil)
  if cond
    true_branch
  else
    false_branch
  end
end

.inc(_rt, *args) ⇒ Object



21
22
23
24
25
26
27
28
29
30
# File 'lib/l43_rmap/functions/predefined.rb', line 21

def inc(_rt, *args)
  case args
  in []
    raise ArgumentError, "inc needs at least 1 argument" if args.empty?
  in [arg] 
    arg.to_i.succ
  else
    args.map(&:to_i).sum
  end
end

.unless_fn(_rt, cond, false_branch, true_branch = nil) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/l43_rmap/functions/predefined.rb', line 32

def unless_fn(_rt, cond, false_branch, true_branch=nil)
  if cond
    true_branch
  else
    false_branch
  end
end