class Lab42::Curry::ArgCompiler

Attributes

ct_blk[R]

Public Class Methods

new(ct_args, ct_kwds, allow_override:, &blk) click to toggle source
# File lib/lab42/curry/arg_compiler.rb, line 33
def initialize(ct_args, ct_kwds, allow_override:, &blk)
  @allow_override = allow_override
  @ct_args = ct_args
  @ct_blk  = blk
  @ct_kwds = ct_kwds

  _precompile!
end

Public Instance Methods

allows_override?() click to toggle source
# File lib/lab42/curry/arg_compiler.rb, line 15
def allows_override?; @allow_override end
compile(rt_args, rt_kwds, rt_blk) click to toggle source
# File lib/lab42/curry/arg_compiler.rb, line 17
def compile(rt_args, rt_kwds, rt_blk)
  Phase2.new(self, rt_args, rt_kwds, rt_blk).compile
end
final_kwds() click to toggle source
# File lib/lab42/curry/arg_compiler.rb, line 28
def final_kwds
  @__final_kwds__ ||= {}
end
positionals() click to toggle source

0 based

# File lib/lab42/curry/arg_compiler.rb, line 24
def positionals
  @__positionals__ ||= Positionals.new 
end

Private Instance Methods

_ct_arg(ct_arg) click to toggle source
# File lib/lab42/curry/arg_compiler.rb, line 42
def _ct_arg ct_arg
  case ct_arg
  when RuntimeArg
    positionals.set_runtime_arg ct_arg
  when CompiletimeArgs
    _set_positions! ct_arg
  when ComputedArg
    positionals.set_computation ct_arg
  else
    _set_final! ct_arg
  end
end
_ct_kwd((key, val)) click to toggle source
# File lib/lab42/curry/arg_compiler.rb, line 55
def _ct_kwd((key, val))
  final_kwds[key]  = val
end
_precompile!() click to toggle source
# File lib/lab42/curry/arg_compiler.rb, line 59
def _precompile!
  @ct_args.each(&method(:_ct_arg))
  @ct_kwds.each(&method(:_ct_kwd))
end
_set_final!(value, pos=nil) click to toggle source
# File lib/lab42/curry/arg_compiler.rb, line 64
def _set_final! value, pos=nil
  positionals.set_value! value, pos
end
_set_position!((position, value)) click to toggle source
# File lib/lab42/curry/arg_compiler.rb, line 68
def _set_position!((position, value))
  positionals.set_value! value, position
end
_set_positions!(ct_arg) click to toggle source
# File lib/lab42/curry/arg_compiler.rb, line 72
def _set_positions! ct_arg
  ct_arg.each(&method(:_set_position!))
end