class Opal::Nodes::Args::ExtractKwrestarg
This node is responsible for extracting a single splat keyword argument from $kwargs
$kwargs always exist (as argument when inlining is possible and as a local variable when it’s not)
Public Instance Methods
compile()
click to toggle source
# File lib/opal/nodes/args/extract_kwrestarg.rb, line 18 def compile # def m(**) # arguments are assigned to `$kw_rest_arg` for super call name = self.name || '$kw_rest_arg' add_temp name helper :kwrestargs push "#{name} = $kwrestargs($kwargs, #{used_kwargs})" end
used_kwargs()
click to toggle source
# File lib/opal/nodes/args/extract_kwrestarg.rb, line 30 def used_kwargs args = scope.used_kwargs.map do |arg_name| "'#{arg_name}': true" end "{#{args.join ','}}" end