lib/activerecord-postgres-composite-types/composite_type_parser.rb
def parse
            return @result if @result
            values = []
            skip(OPEN_PAREN)
            if skip(CLOSE_PAREN)
              values << nil
            else
              until eos?
                if skip(QUOTE_RE)
                  values << scan(QUOTED_RE).gsub(REPLACE_RE, REPLACE_WITH)
                  skip(QUOTE_SEP_RE)
                else
                  v = scan(UNQUOTED_RE)
                  values << (v unless v.empty?)
                  skip(SEP_RE)
                end
              end
            end
            values
          end
# Split the stored string into an array of strings, handling
# the different types of quoting.
Split the stored string into an array of strings, handling
the different types of quoting.
Split the stored string into an array of strings handling the different types of quoting .
def parse
            return @result if @result
            values = []
            skip(OPEN_PAREN)
            if skip(CLOSE_PAREN)
              values << nil
            else
              until eos?
                if skip(QUOTE_RE)
                  values << scan(QUOTED_RE).gsub(REPLACE_RE, REPLACE_WITH)
                  skip(QUOTE_SEP_RE)
                else
                  v = scan(UNQUOTED_RE)
                  values << (v unless v.empty?)
                  skip(SEP_RE)
                end
              end
            end
            values
          end
def parse return @result if @result values = [ ] skip ( OPEN_PAREN ) if skip ( CLOSE_PAREN ) values << nil else until eos? if skip ( QUOTE_RE ) values << scan ( QUOTED_RE ) . gsub ( REPLACE_RE , REPLACE_WITH ) skip ( QUOTE_SEP_RE ) else v = scan ( UNQUOTED_RE ) values << ( v unless v . empty? ) skip ( SEP_RE ) end end end values end
Split the stored string into an array of strings, handling
the different types of quoting.
Split the stored string into an array of strings handling the different types of quoting .