From: Shawn M Moore Date: Sun, 18 Jan 2009 02:46:31 +0000 (+0000) Subject: Rename parameter_metaclass to parameters_metaclass X-Git-Tag: 0.05~19 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f8f365484c40dd9778eb8611a0764857641831e1;p=gitmo%2FMooseX-Role-Parameterized.git Rename parameter_metaclass to parameters_metaclass --- diff --git a/lib/MooseX/Role/Parameterized/Meta/Role/Parameterizable.pm b/lib/MooseX/Role/Parameterized/Meta/Role/Parameterizable.pm index 9a0c2af..b66d86e 100644 --- a/lib/MooseX/Role/Parameterized/Meta/Role/Parameterizable.pm +++ b/lib/MooseX/Role/Parameterized/Meta/Role/Parameterizable.pm @@ -7,7 +7,7 @@ use MooseX::Role::Parameterized::Parameters; use constant parameterized_role_metaclass => 'MooseX::Role::Parameterized::Meta::Role::Parameterized'; -has parameter_metaclass => ( +has parameters_metaclass => ( is => 'rw', isa => 'Moose::Meta::Class', lazy => 1, @@ -36,7 +36,7 @@ sub add_parameter { if $name eq 'alias' || $name eq 'excludes'; - $self->parameter_metaclass->add_attribute($name => @_); + $self->parameters_metaclass->add_attribute($name => @_); } sub construct_parameters { @@ -49,7 +49,7 @@ sub construct_parameters { if exists $args{$name}; } - $self->parameter_metaclass->new_object(\%args); + $self->parameters_metaclass->new_object(\%args); } sub generate_role { diff --git a/t/001-parameters.t b/t/001-parameters.t index 53cd430..85d9ae4 100644 --- a/t/001-parameters.t +++ b/t/001-parameters.t @@ -14,8 +14,8 @@ do { use MooseX::Role::Parameterized; }; -my $parameter_metaclass = MyRole::NoParameters->meta->parameter_metaclass; -is($parameter_metaclass->get_all_attributes, 0, "no parameters"); +my $parameters_metaclass = MyRole::NoParameters->meta->parameters_metaclass; +is($parameters_metaclass->get_all_attributes, 0, "no parameters"); do { package MyRole::LengthParameter; @@ -28,10 +28,10 @@ do { ); }; -$parameter_metaclass = MyRole::LengthParameter->meta->parameter_metaclass; -is($parameter_metaclass->get_all_attributes, 1, "exactly one parameter"); +$parameters_metaclass = MyRole::LengthParameter->meta->parameters_metaclass; +is($parameters_metaclass->get_all_attributes, 1, "exactly one parameter"); -my $parameter = ($parameter_metaclass->get_all_attributes)[0]; +my $parameter = ($parameters_metaclass->get_all_attributes)[0]; isa_ok($parameter, 'MooseX::Role::Parameterized::Meta::Parameter'); is($parameter->name, 'length', "parameter name"); ok($parameter->is_required, "parameter is required"); @@ -60,11 +60,11 @@ do { ); }; -$parameter_metaclass = MyRole::LengthParameter->meta->parameter_metaclass; -is($parameter_metaclass->get_all_attributes, 3, "three parameters"); +$parameters_metaclass = MyRole::LengthParameter->meta->parameters_metaclass; +is($parameters_metaclass->get_all_attributes, 3, "three parameters"); for my $param_name ('first_name', 'last_name') { - my $param = $parameter_metaclass->get_attribute($param_name); + my $param = $parameters_metaclass->get_attribute($param_name); is($param->type_constraint, 'Str', "$param_name type constraint"); ok(!$param->is_required, "$param_name is optional"); }