factor quote method out of Generator::Utils
[dbsrgits/SQL-Translator.git] / lib / SQL / Translator / Generator / Utils.pm
CommitLineData
c13f5f6a 1package # hide from pause
fd9f0e09 2 SQL::Translator::Generator::Utils;
27ae9ae7 3
4use Moo;
5use Sub::Quote 'quote_sub';
6
7# this should be ro, but I have to modify it in BUILD so bleh
8has quote_chars => ( is => 'rw' );
9
10has name_sep => (
11 is => 'ro',
12 default => quote_sub q{ '.' },
13);
14
598a2461 15with 'SQL::Translator::Generator::Role::Quote';
16
27ae9ae7 17sub BUILD {
18 my $self = shift;
19
20 unless (ref($self->quote_chars)) {
21 if ($self->quote_chars) {
22 $self->quote_chars([$self->quote_chars])
23 } else {
24 $self->quote_chars([])
25 }
26 }
27
28 $self
29}
30
27ae9ae7 311;