[Rt-commit] r5594 - in Object-Declare: lib/Object t
audreyt at bestpractical.com
audreyt at bestpractical.com
Mon Jul 17 19:59:48 EDT 2006
Author: audreyt
Date: Mon Jul 17 19:59:46 2006
New Revision: 5594
Modified:
Object-Declare/Changes
Object-Declare/lib/Object/Declare.pm
Object-Declare/t/01-basic.t
Log:
* This be 0.04.
* Support for plural values via "are":
column x =>
field1 is 'xxx',
field2 are 'XXX', 'XXX', # <-- Plural value
is field3;
Modified: Object-Declare/Changes
==============================================================================
--- Object-Declare/Changes (original)
+++ Object-Declare/Changes Mon Jul 17 19:59:46 2006
@@ -1,3 +1,12 @@
+[Changes for 0.04 - 2006-07-17]
+
+* Support for plural values via "are":
+
+ column x =>
+ field1 is 'xxx',
+ field2 are 'XXX', 'XXX', # <-- Plural value
+ is field3;
+
[Changes for 0.03 - 2006-07-17]
* The declarator can now be exported to another package;
Modified: Object-Declare/lib/Object/Declare.pm
==============================================================================
--- Object-Declare/lib/Object/Declare.pm (original)
+++ Object-Declare/lib/Object/Declare.pm Mon Jul 17 19:59:46 2006
@@ -1,5 +1,5 @@
package Object::Declare;
-$Object::Declare::VERSION = '0.03';
+$Object::Declare::VERSION = '0.04';
use 5.006;
use strict;
@@ -97,7 +97,21 @@
package Object::Declare::Katamari;
sub unroll {
- map { ref($_) eq __PACKAGE__ ? $_->unroll : $_ } @{$_[0]}
+ my @katamari = @{$_[0]} or return ();
+ my $field = shift @katamari or return ();
+ my @unrolled;
+
+ unshift @unrolled, pop(@katamari)->unroll
+ while ref($katamari[-1]) eq __PACKAGE__;
+
+ if (@katamari == 1) {
+ # Singular value
+ return($field => @katamari, @unrolled);
+ }
+ else {
+ # Plural value
+ return($field => \@katamari, @unrolled);
+ }
}
1;
Modified: Object-Declare/t/01-basic.t
==============================================================================
--- Object-Declare/t/01-basic.t (original)
+++ Object-Declare/t/01-basic.t Mon Jul 17 19:59:46 2006
@@ -8,7 +8,7 @@
column x =>
field1 is 'xxx',
- field2 is 'XXX',
+ field2 are 'XXX', 'XXX',
is field3;
column y =>
@@ -20,7 +20,7 @@
is_deeply($objects => {
x => {
'field1' => 'xxx',
- 'field2' => 'XXX',
+ 'field2' => ['XXX', 'XXX'],
'field3' => 1
},
y => {
More information about the Rt-commit
mailing list