2 class SQL::Translator::Object {
4 use MooseX::MultiMethods;
5 use MooseX::Types::Moose qw(Any ArrayRef HashRef Str);
8 metaclass => 'Collection::Array',
12 push => 'add_comment',
13 pop => 'remove_last_comment',
15 default => sub { [] },
20 metaclass => 'Collection::Array',
25 pop => 'remove_last_option',
27 default => sub { [] },
32 metaclass => 'Collection::Hash',
36 exists => 'exists_extra',
38 values => 'get_extras',
42 default => sub { {} },
46 multi method comments(Str $comment) { $self->add_comment($comment) }
47 multi method comments(ArrayRef $comments) { $self->add_comment($_) for @$comments }
48 multi method comments(Any $) { wantarray ? @{$self->_comments} : join "\n", $self->_comments }
50 multi method options(Str $option) { $self->add_option($option) }
51 multi method options(ArrayRef $options) { $self->add_option($_) for @$options }
52 multi method options(Any $) { wantarray ? @{$self->_options} : $self->_options }
54 multi method extra(Str $extra) { $self->get_extra($extra) }
55 multi method extra(HashRef $extra) { $self->_extra($extra) }
56 multi method extra(Any $) { wantarray ? %{$self->_extra} : $self->_extra }