stringify the table object
[dbsrgits/SQL-Translator-2.0-ish.git] / lib / SQL / Translator / Object.pm
index 7302766..a6640b9 100644 (file)
@@ -5,50 +5,50 @@ class SQL::Translator::Object {
     use MooseX::Types::Moose qw(Any ArrayRef HashRef Str);
 
     has '_comments' => (
-        metaclass => 'Collection::Array',
+        traits => ['Array'],
         is => 'rw',
         isa => ArrayRef,
-        provides => {
-            push => 'add_comment',
-            pop  => 'remove_last_comment',
+        handles => {
+            add_comment         => 'push',
+            remove_last_comment => 'pop',
         },
         default => sub { [] },
         auto_deref => 1,
     );
 
     has '_options' => (
-        metaclass => 'Collection::Array',
+        traits => ['Array'],
         is => 'rw',
         isa => ArrayRef,
-        provides => {
-            push => 'add_option',
-            pop  => 'remove_last_option',
+        handles => {
+            add_option         => 'push',
+            remove_last_option => 'pop',
         },
         default => sub { [] },
         auto_deref => 1,
     );
 
     has '_extra' => (
-        metaclass => 'Collection::Hash',
+        traits => ['Hash'],
         is => 'rw',
         isa => HashRef,
-        provides => {
-            exists => 'exists_extra',
-            keys   => 'extra_ids',
-            values => 'get_extras',
-            get    => 'get_extra',
-            set    => 'add_extra',
+        handles => {
+            exists_extra => 'exists',
+            extra_ids    => 'keys',
+            get_extras   => 'values',
+            get_extra    => 'get',
+            add_extra    => 'set',
         },
         default => sub { {} },
         auto_deref => 1,
     );
 
     multi method comments(Str $comment) { $self->add_comment($comment) }
-    multi method comments(ArrayRef $comment) { $self->add_comment($comment) }
+    multi method comments(ArrayRef $comments) { $self->add_comment($_) for @$comments }
     multi method comments(Any $) { wantarray ? @{$self->_comments} : join "\n", $self->_comments }
 
     multi method options(Str $option) { $self->add_option($option) }
-    multi method options(ArrayRef $option) { $self->add_option($option) if scalar @$option }
+    multi method options(ArrayRef $options) { $self->add_option($_) for @$options }
     multi method options(Any $) { wantarray ? @{$self->_options} : $self->_options }
 
     multi method extra(Str $extra) { $self->get_extra($extra) }