Arbitrary Keyword Arguments
The double asterisk symbol (**
) is used to denote arbitrary keyword arguments in a method definition. These are also referred to as kwargs (pronounced phonentically).
Not quite what you're looking for? See the Double Splat page or the Asterisk page for other ways that the asterisk symbol is used.
Here is an example of defining a method that accepts arbitrary keyword arguments.
def some_method(**kwargs)
if kwargs[:user_id]
puts "User ID: #{kwargs[:user_id]}"
end
end