Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add class method to add disambiguation #45

Open
librasteve opened this issue Jan 17, 2021 · 0 comments
Open

Add class method to add disambiguation #45

librasteve opened this issue Jan 17, 2021 · 0 comments

Comments

@librasteve
Copy link
Owner

This gives type => Length, Reach

Custom Measures
To make a custom Measure, you can use this incantation:

GetMeaUnit('nmile').NewType('Reach');

class Reach is Measure {
    has $.units where *.name eq <nm nmile nmiles>.any;

    #| override .in to perform identity 1' (Latitude) == 1 nmile
    method in( Str $s where * eq <Latitude> ) { 
        my $nv = $.value / 60; 
        Latitude.new( value => $nv, compass => <N> )
    }   
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant