txt: ## capture.md
  Capture
  
  Combined from primary sources listed below.
  
  # [In Signature](#___top "go to top of document")[§](#(Signature)_method_Capture "direct link")
  
  See primary documentation
  [in context](/type/Signature#method_Capture)
  for **method Capture**.
  
  ```raku
  method Capture()
  ```
  
  Throws [`X::Cannot::Capture`](/type/X/Cannot/Capture).
  
  # [In List](#___top "go to top of document")[§](#(List)_method_Capture "direct link")
  
  See primary documentation
  [in context](/type/List#method_Capture)
  for **method Capture**.
  
  ```raku
  method Capture(List:D: --> Capture:D)
  ```
  
  Returns a [`Capture`](/type/Capture) where each [`Pair`](/type/Pair), if any, in the <`List` has been converted to a named argument (with the [key](/type/Pair#method_key) of the [`Pair`](/type/Pair) stringified). All other elements in the `List` are converted to positional arguments in the order they are found, i.e. the first non pair item in the list becomes the first positional argument, which gets index `0`, the second non pair item becomes the second positional argument, getting index `1` etc.
  
  ```raku
  my $list = (7, 5, a => 2, b => 17);
  my $capture = $list.Capture;
  say $capture.keys;                                # OUTPUT: «(0 1 a b)␤»
  my-sub(|$capture);                                # OUTPUT: «7, 5, 2, 17␤»
  
  sub my-sub($first, $second, :$a, :$b) {
      say "$first, $second, $a, $b"
  }
  ```
  
  A more advanced example demonstrating the returned [`Capture`](/type/Capture) being matched against a [`Signature`](/type/Signature).
  
  ```raku
  my $list = (7, 5, a => 2, b => 17);
  say so $list.Capture ~~ :($ where * == 7,$,:$a,:$b); # OUTPUT: «True␤»
  
  $list = (8, 5, a => 2, b => 17);
  say so $list.Capture ~~ :($ where * == 7,$,:$a,:$b); # OUTPUT: «False␤»
  ```
  
  # [In Num](#___top "go to top of document")[§](#(Num)_method_Capture "direct link")
  
  See primary documentation
  [in context](/type/Num#method_Capture)
  for **method Capture**.
  
  ```raku
  method Capture()
  ```
  
  Throws `X::Cannot::Capture`.
  
  # [In Capture](#___top "go to top of document")[§](#(Capture)_method_Capture "direct link")
  
  See primary documentation
  [in context](/type/Capture#method_Capture)
  for **method Capture**.
  
  ```raku
  method Capture(Capture:D: --> Capture:D)
  ```
  
  Returns itself, i.e. the invocant.
  
  ```raku
  say \(1,2,3, apples => 2).Capture; # OUTPUT: «\(1, 2, 3, :apples(2))␤»
  ```
  
  # [In Version](#___top "go to top of document")[§](#(Version)_method_Capture "direct link")
  
  See primary documentation
  [in context](/type/Version#method_Capture)
  for **method Capture**.
  
  ```raku
  method Capture()
  ```
  
  Throws [`X::Cannot::Capture`](/type/X/Cannot/Capture).
  
  # [In Str](#___top "go to top of document")[§](#(Str)_method_Capture "direct link")
  
  See primary documentation
  [in context](/type/Str#method_Capture)
  for **method Capture**.
  
  ```raku
  method Capture()
  ```
  
  Throws `X::Cannot::Capture`.
  
  # [In Seq](#___top "go to top of document")[§](#(Seq)_method_Capture "direct link")
  
  See primary documentation
  [in context](/type/Seq#method_Capture)
  for **method Capture**.
  
  ```raku
  method Capture()
  ```
  
  Coerces the object to a [`List`](/type/List), which is in turn coerced into a [`Capture`](/type/Capture).
  
  # [In Range](#___top "go to top of document")[§](#(Range)_method_Capture "direct link")
  
  See primary documentation
  [in context](/type/Range#method_Capture)
  for **method Capture**.
  
  ```raku
  method Capture(Range:D: --> Capture:D)
  ```
  
  Returns a [`Capture`](/type/Capture) with values of [`.min`](/type/Range#method_min) [`.max`](/type/Range#method_max), [`.excludes-min`](/type/Range#method_excludes-min), [`.excludes-max`](/type/Range#method_excludes-max), [`.infinite`](/type/Range#method_infinite), and [`.is-int`](/type/Range#method_is-int) as named arguments.
  
  # [In Map](#___top "go to top of document")[§](#(Map)_method_Capture "direct link")
  
  See primary documentation
  [in context](/type/Map#method_Capture)
  for **method Capture**.
  
  ```raku
  method Capture(Map:D:)
  ```
  
  Returns a [`Capture`](/type/Capture) where each key, if any, has been converted to a named argument with the same value as it had in the original `Map`. The returned [`Capture`](/type/Capture) will not contain any positional arguments.
  
  ```raku
  my $map = Map.new('a' => 2, 'b' => 17);
  my $capture = $map.Capture;
  my-sub(|$capture);                                # OUTPUT: «2, 17␤»
  
  sub my-sub(:$a, :$b) {
      say "$a, $b"
  }
  ```
  
  # [In Whatever](#___top "go to top of document")[§](#(Whatever)_method_Capture "direct link")
  
  See primary documentation
  [in context](/type/Whatever#method_Capture)
  for **method Capture**.
  
  ```raku
  method Capture()
  ```
  
  Throws `X::Cannot::Capture`.
  
  # [In Mu](#___top "go to top of document")[§](#(Mu)_method_Capture "direct link")
  
  See primary documentation
  [in context](/type/Mu#method_Capture)
  for **method Capture**.
  
  ```raku
  method Capture(Mu:D: --> Capture:D)
  ```
  
  Returns a [`Capture`](/type/Capture) with named arguments corresponding to invocant's public attributes:
  
  ```raku
  class Foo {
      has $.foo = 42;
      has $.bar = 70;
      method bar { 'something else' }
  }.new.Capture.say; # OUTPUT: «\(:bar("something else"), :foo(42))␤»
  ```
  
  # [In Failure](#___top "go to top of document")[§](#(Failure)_method_Capture "direct link")
  
  See primary documentation
  [in context](/type/Failure#method_Capture)
  for **method Capture**.
  
  ```raku
  method Capture()
  ```
  
  Throws `X::Cannot::Capture` if the invocant is a type object or a [handled](/routine/handled) `Failure`. Otherwise, throws the invocant's [exception](/routine/exception).
  
  # [In role Blob](#___top "go to top of document")[§](#(role_Blob)_method_Capture "direct link")
  
  See primary documentation
  [in context](/type/Blob#method_Capture)
  for **method Capture**.
  
  ```raku
  method Capture(Blob:D:)
  ```
  
  Converts the object to a [`List`](/type/List) which is, in turn, coerced to a [`Capture`](/type/Capture).
  
  # [In role QuantHash](#___top "go to top of document")[§](#(role_QuantHash)_method_Capture "direct link")
  
  See primary documentation
  [in context](/type/QuantHash#method_Capture)
  for **method Capture**.
  
  ```raku
  method Capture()
  ```
  
  Returns the object as a [`Capture`](/type/Capture) by previously coercing it to a [`Hash`](/type/Hash).
  
  # [In Channel](#___top "go to top of document")[§](#(Channel)_method_Capture "direct link")
  
  See primary documentation
  [in context](/type/Channel#method_Capture)
  for **method Capture**.
  
  ```raku
  method Capture(Channel:D: --> Capture:D)
  ```
  
  Equivalent to calling [`.List.Capture`](/type/List#method_Capture) on the invocant.
  
  # [In Int](#___top "go to top of document")[§](#(Int)_method_Capture "direct link")
  
  See primary documentation
  [in context](/type/Int#method_Capture)
  for **method Capture**.
  
  ```raku
  method Capture()
  ```
  
  Throws `X::Cannot::Capture`.
  
  # [In role Callable](#___top "go to top of document")[§](#(role_Callable)_method_Capture "direct link")
  
  See primary documentation
  [in context](/type/Callable#method_Capture)
  for **method Capture**.
  
  ```raku
  method Capture()
  ```
  
  Throws [`X::Cannot::Capture`](/type/X/Cannot/Capture).
  
  # [In ComplexStr](#___top "go to top of document")[§](#(ComplexStr)_method_Capture "direct link")
  
  See primary documentation
  [in context](/type/ComplexStr#method_Capture)
  for **method Capture**.
  
  ```raku
  method Capture(ComplexStr:D: --> Capture:D)
  ```
  
  Equivalent to [`Mu.Capture`](/type/Mu#method_Capture).
  
  # [In RatStr](#___top "go to top of document")[§](#(RatStr)_method_Capture "direct link")
  
  See primary documentation
  [in context](/type/RatStr#method_Capture)
  for **method Capture**.
  
  ```raku
  method Capture(RatStr:D: --> Capture:D)
  ```
  
  Equivalent to [`Mu.Capture`](/type/Mu#method_Capture).
  
  # [In Supply](#___top "go to top of document")[§](#(Supply)_method_Capture "direct link")
  
  See primary documentation
  [in context](/type/Supply#method_Capture)
  for **method Capture**.
  
  ```raku
  method Capture(Supply:D: --> Capture:D)
  ```
  
  Equivalent to calling [`.List.Capture`](/type/List#method_Capture) on the invocant.
  