| 1 | package Test::SpellCheck::Plugin::StopWords; | ||||||||||
| 2 | |||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 2 | ▶ | use 5.026; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 2 | ▶ | use experimental qw( signatures ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 2 | ▶ | use Path::Tiny qw( path ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 2 | ▶ | use Ref::Util qw( is_plain_arrayref ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | # ABSTRACT: Test::SpellCheck plugin that adds arbitrary jargon words | ||||||||||
| 11 | 2 | our $VERSION = '0.02'; # VERSION | |||||||||
| 12 | |||||||||||
| 13 | |||||||||||
| 14 | 8 | ▶ | sub new ($class, %args) | ||||||||
|
Subroutine
new: called CC=6 SCAR=17.9
Pod
documented
| |||||||||||
| 15 | { | ||||||||||
| 16 | 8 | my %stopwords; | |||||||||
| 17 | |||||||||||
| 18 | 8 | ▶ | if($args{file}) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 19 | { | ||||||||||
| 20 | 3 | my @words = path($args{file})->lines_utf8; | |||||||||
| 21 | 3 | chomp @words; | |||||||||
| 22 | 3 | $stopwords{$_} = 1 for @words; | |||||||||
| 23 | } | ||||||||||
| 24 | |||||||||||
| 25 | 8 | ▶ | if(defined $args{word}) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 26 | { | ||||||||||
| 27 | 6 | ▶ | if(is_plain_arrayref $args{word}) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 28 | { | ||||||||||
| 29 | 4 | $stopwords{$_} = 1 for $args{word}->@*; | |||||||||
| 30 | } | ||||||||||
| 31 | else | ||||||||||
| 32 | { | ||||||||||
| 33 | 2 | $stopwords{$args{word}} = 1; | |||||||||
| 34 | } | ||||||||||
| 35 | } | ||||||||||
| 36 | |||||||||||
| 37 | bless { | ||||||||||
| 38 | 8 | stopwords => [sort keys %stopwords], | |||||||||
| 39 | }, $class; | ||||||||||
| 40 | } | ||||||||||
| 41 | |||||||||||
| 42 | |||||||||||
| 43 | 8 | ▶ | sub stopwords ($self) | ||||||||
|
Subroutine
stopwords: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 44 | { | ||||||||||
| 45 | 8 | return $self->{stopwords}->@*; | |||||||||
| 46 | } | ||||||||||
| 47 | |||||||||||
| 48 | 2 | 1; | |||||||||
| 49 | |||||||||||
| 50 | __END__ | ||||||||||