Module: CreateTable::Parser
- Included in:
- CreateTable, Column, Index
- Defined in:
- lib/create_table/parser.rb
Constant Summary collapse
- SQL_COMMENT =
%r{/\*(?:.|[\r\n])*?\*/}m
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.remove_comments(str) ⇒ Object
3 4 5 |
# File 'lib/create_table/parser.rb', line 3 def Parser.remove_comments(str) str.gsub SQL_COMMENT, '' end |
Instance Method Details
#read(data, s, p) ⇒ Object
10 11 12 |
# File 'lib/create_table/parser.rb', line 10 def read(data, s, p) data[s...p].pack('c*') end |
#read_quoted(data, s, p) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/create_table/parser.rb', line 14 def read_quoted(data, s, p) memo = read data, s, p memo.gsub! %{\\\'}, %{'} memo.gsub! %{\\\"}, %{"} memo.gsub! /(['"])\1/, '\1' memo end |