| 1 | package Neovim::RPC::API::Command; | ||||||||||
| 2 | 5 | our $AUTHORITY = 'cpan:YANICK'; | |||||||||
| 3 | 5 | $Neovim::RPC::API::Command::VERSION = '0.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 => { all_parameters => 'elements' }, | |||||||||
| 35 | ); | ||||||||||
| 36 | |||||||||||
| 37 | 5 | has receives_channel_id => ( | |||||||||
| 38 | is => 'ro', | ||||||||||
| 39 | ); | ||||||||||
| 40 | |||||||||||
| 41 | 5 | has return_type => ( | |||||||||
| 42 | is => 'ro', | ||||||||||
| 43 | ); | ||||||||||
| 44 | |||||||||||
| 45 | sub args_to_struct { | ||||||||||
| 46 | 0 | ▶ | my( $self, %args ) = @_; | ||||||||
|
Subroutine
args_to_struct: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 47 | |||||||||||
| 48 | [ | ||||||||||
| 49 | pairmap { | ||||||||||
| 50 | 0 | ▶ | my $type = $self->api->types->{$a}; | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||
| 51 | 0 | ▶ | defined $type | ||||||||
|
Branch: 1 branch
| |||||||||||
| 52 | ? MsgPack::Type::Ext->new( type => $type, data => $b ) | ||||||||||
| 53 | : $b | ||||||||||
| 54 | } | ||||||||||
| 55 | 0 | map { $_->[0] => $args{$_->[1]} } $self->parameters->@* ] | |||||||||
| 56 | } | ||||||||||
| 57 | |||||||||||
| 58 | sub encode { | ||||||||||
| 59 | 0 | ▶ | my $self = shift; | ||||||||
|
Subroutine
encode: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 60 | 0 | ▶ | my $struct = @_ == 1 ? shift : $self->to_struct(@_); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 61 | |||||||||||
| 62 | 0 | return MsgPack::Encoder->new( struct => $struct ); | |||||||||
| 63 | } | ||||||||||
| 64 | |||||||||||
| 65 | 5 | 1; | |||||||||
| 66 | |||||||||||
| 67 | __END__ | ||||||||||
| 68 | |||||||||||
| 69 | =pod | ||||||||||
| 70 | |||||||||||
| 71 | =encoding UTF-8 | ||||||||||
| 72 | |||||||||||
| 73 | =head1 NAME | ||||||||||
| 74 | |||||||||||
| 75 | Neovim::RPC::API::Command | ||||||||||
| 76 | |||||||||||
| 77 | =head1 VERSION | ||||||||||
| 78 | |||||||||||
| 79 | version 0.0.1 | ||||||||||
| 80 | |||||||||||
| 81 | =head1 AUTHOR | ||||||||||
| 82 | |||||||||||
| 83 | Yanick Champoux <yanick@cpan.org> | ||||||||||
| 84 | |||||||||||
| 85 | =head1 COPYRIGHT AND LICENSE | ||||||||||
| 86 | |||||||||||
| 87 | This software is copyright (c) 2015 by Yanick Champoux. | ||||||||||
| 88 | |||||||||||
| 89 | This is free software; you can redistribute it and/or modify it under | ||||||||||
| 90 | the same terms as the Perl 5 programming language system itself. | ||||||||||
| 91 | |||||||||||
| 92 | =cut | ||||||||||