NAME

Git::Wrapper::Plus::Support::RangeDictionary - A key -> range list mapping for support features

VERSION

version 0.004011

SYNOPSIS

The RangeDictionary associates tokens with RangeSets of Ranges that support that token.

my $dict = Git::Wrapper::Plus::Support::RangeDictionary->new();
$dict->add_range('foo' => {
    min => '1.0', max => '2.0'
});
$dict->add_range('bar' => {
    min => '3.0', max => '4.0'
});
# Returns true on Git 3.5, False on 2.5
$dict->has_entry('bar') and $dict->entry_supports('bar', $version_object );

METHODS

add_range

$dict->add_range( name => { min => 5, max => 6 });
$dict->add_range( name => { min => 7, max => 8 });

Is equivalent to:

$dict->dictionary->{name} = ::RangeSet->new(
    items => [
        ::Range->new( min => 5, max => 6 ),
        ::Range->new( min => 7, max => 8 ),
    ],
);

That is, this is a shorthand to say that for given token name, that the given parameters define an additional range of versions to incorporate as being considered "supported".

has_entry

Determines if a given name has associated data or not.

$dict->has_entry('name')

This method returning undef should indicate that a features support status is either unknown, or undocumented, and you should proceed with caution, assuming either support, or non support, based on preference.

entries

Returns the list of features that ranges exist for

for my $entry ( $dict->entries ) {

}

entry_supports

Determine if a given feature supports a given version

$dict->entry_supports( $name, $version_object );

For instance:

$dict->entry_supports('add', $gwp->versoins );

AUTHOR

Kent Fredric <kentnl@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2017 by Kent Fredric <kentfredric@gmail.com>.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.