<commit_before>package MooseX::AttributeShortcuts::Trait::Attribute::HasAnonBuilder;

# ABSTRACT: Attributes, etc, common to both the role-attribute and attribute traits

use Moose::Role;
use namespace::autoclean 0.24;

has anon_builder => (
    reader    => 'anon_builder',
    writer    => '_set_anon_builder',
    isa       => 'CodeRef',
    predicate => 'has_anon_builder',
    # init_arg  => '_anon_builder',
);

has anon_builder_installed => (
    traits  => ['Bool'],
    is      => 'ro',
    default => 0,
    handles => {
        _set_anon_builder_installed => 'set',
    },
);

# FIXME Something Odd keeps this from succeeding as we'd like.
#requires 'canonical_builder_prefix';

sub _mxas_builder_name {
    my ($class, $name) = @_;

    return $class->canonical_builder_prefix . $name;
}

# this is identical between role and class attributes

sub _builder_method_meta {
    my ($self, $thing) = @_;

    # my $class =
    my $dc = $self->definition_context;

    $dc->{description}
        = 'builder ' . $thing->name . '::' . $self->builder
        . ' of attribute ' . $self->name
        ;

    return $self->builder_method_metaclass->wrap($self->anon_builder =>
        associated_attribute => $self,
        associated_metaclass => $thing,<commit_msg>Copy the attribute's definition context for the builder method<commit_after>package MooseX::AttributeShortcuts::Trait::Attribute::HasAnonBuilder;

# ABSTRACT: Attributes, etc, common to both the role-attribute and attribute traits

use Moose::Role;
use namespace::autoclean 0.24;

has anon_builder => (
    reader    => 'anon_builder',
    writer    => '_set_anon_builder',
    isa       => 'CodeRef',
    predicate => 'has_anon_builder',
    # init_arg  => '_anon_builder',
);

has anon_builder_installed => (
    traits  => ['Bool'],
    is      => 'ro',
    default => 0,
    handles => {
        _set_anon_builder_installed => 'set',
    },
);

# FIXME Something Odd keeps this from succeeding as we'd like.
#requires 'canonical_builder_prefix';

sub _mxas_builder_name {
    my ($class, $name) = @_;

    return $class->canonical_builder_prefix . $name;
}

# this is identical between role and class attributes

sub _builder_method_meta {
    my ($self, $thing) = @_;

    my $dc = { %{$self->definition_context} };

    $dc->{description}
        = 'builder ' . $thing->name . '::' . $self->builder
        . ' of attribute ' . $self->name
        ;

    return $self->builder_method_metaclass->wrap($self->anon_builder =>
        associated_attribute => $self,
        associated_metaclass => $thing,
{'fraction_non_alphanumeric': 0.13703416149068323, 'fraction_numerical': 0.003105590062111801, 'mean_word_length': 3.231527093596059, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 51, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '14781', 'n_tokens_mistral': 831, 'n_tokens_neox': 801, 'n_words': 189}