migrate duplicated code into role
[dbsrgits/SQL-Translator.git] / lib / SQL / Translator / Generator / Utils.pm
1 package # hide from pause
2   SQL::Translator::Generator::Utils;
3
4 use Moo;
5 use Sub::Quote 'quote_sub';
6
7 # this should be ro, but I have to modify it in BUILD so bleh
8 has quote_chars => ( is => 'rw' );
9
10 has name_sep    => (
11    is => 'ro',
12    default => quote_sub q{ '.' },
13 );
14
15 with 'SQL::Translator::Generator::Role::Quote';
16
17 sub 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
31 1;