### ----------------------------------------------------
### -- LibXML::Class
### -- Licenses: Artistic-2.0
### -- Authors: Vadim Belman
### -- File: lib/LibXML/Class/HOW/Named.rakumod
### ----------------------------------------------------
use v6.e.PREVIEW;
unit role LibXML::Class::HOW::Named;

# Default element name
has Str $!xml-name;

method xml-set-name(Mu, Str:D $!xml-name) {}

method xml-has-name(Mu) { $!xml-name.defined }

method xml-name(Mu $?) {
    $!xml-name
}

method xml-default-name(Mu \obj) {
    $!xml-name // obj.^shortname
}

# Copyright (c) 2023, Vadim Belman <vrurg@cpan.org>
#
# See the LICENSE file for the license


