| 1 | package Neovim::RPC::API::Command; | ||||||||||
| 2 | 5 | our $AUTHORITY = 'cpan:YANICK'; | |||||||||
| 3 | 5 | $Neovim::RPC::API::Command::VERSION = '1.0.1'; | |||||||||
| 4 | 5 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 5 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 5 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 5 | ▶ | use MsgPack::Encoder; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 5 | ▶ | use MsgPack::Type::Ext; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 5 | ▶ | use List::Util qw/ pairmap /; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | |||||||||||
| 13 | 5 | ▶ | use experimental 'postderef'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | |||||||||||
| 15 | 5 | has api => ( | |||||||||
| 16 | is => 'ro', | ||||||||||
| 17 | ); | ||||||||||
| 18 | |||||||||||
| 19 | 5 | has deferred => ( | |||||||||
| 20 | is => 'ro', | ||||||||||
| 21 | default => 1, | ||||||||||
| 22 | ); | ||||||||||
| 23 | |||||||||||
| 24 | 5 | has name => ( | |||||||||
| 25 | is => 'ro', | ||||||||||
| 26 | required => 1, | ||||||||||
| 27 | ); | ||||||||||
| 28 | |||||||||||
| 29 | has parameters => ( | ||||||||||
| 30 | traits => [ 'Array' ], | ||||||||||
| 31 | isa => 'ArrayRef', | ||||||||||
| 32 | is => 'ro', | ||||||||||
| 33 | 0 | ▶ | default => sub { [] }, | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 34 | 5 | handles => { | |||||||||
| 35 | all_parameters => 'elements', | ||||||||||
| 36 | num_parameters => 'count', | ||||||||||
| 37 | }, | ||||||||||
| 38 | ); | ||||||||||
| 39 | |||||||||||
| 40 | 5 | has receives_channel_id => ( | |||||||||
| 41 | is => 'ro', | ||||||||||
| 42 | ); | ||||||||||
| 43 | |||||||||||
| 44 | 5 | has return_type => ( | |||||||||
| 45 | is => 'ro', | ||||||||||
| 46 | ); | ||||||||||
| 47 | |||||||||||
| 48 | 0 | ▶ | sub args_to_struct { | ||||||||
|
Subroutine
args_to_struct: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||
| 49 | 0 | my( $self, @args ) = @_; | |||||||||
| 50 | |||||||||||
| 51 | |||||||||||
| 52 | 0 | my $is_hash = @args == 2 * $self->num_parameters; | |||||||||
| 53 | 0 | ▶ | my %args = $is_hash ? @args : (); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 54 | |||||||||||
| 55 | [ | ||||||||||
| 56 | 0 | ▶ | pairmap { | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||
| 57 | 0 | my $type = $self->api->types->{$a}; | |||||||||
| 58 | 0 | ▶ | defined $type | ||||||||
|
Branch: 1 branch
| |||||||||||
| 59 | ? MsgPack::Type::Ext->new( type => $type, data => $b )->data | ||||||||||
| 60 | : $b | ||||||||||
| 61 | } | ||||||||||
| 62 | 0 | ▶ | map { $_->[0] => $is_hash ? $args{$_->[1]} : shift @args } $self->all_parameters ] | ||||||||
|
Branch: 1 branch
| |||||||||||
| 63 | } | ||||||||||
| 64 | |||||||||||
| 65 | 0 | ▶ | sub encode { | ||||||||
|
Subroutine
encode: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 66 | 0 | my $self = shift; | |||||||||
| 67 | 0 | ▶ | my $struct = @_ == 1 ? shift : $self->to_struct(@_); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 68 | |||||||||||
| 69 | 0 | return MsgPack::Encoder->new( struct => $struct ); | |||||||||
| 70 | } | ||||||||||
| 71 | |||||||||||
| 72 | 5 | 1; | |||||||||
| 73 | |||||||||||
| 74 | __END__ | ||||||||||