lib/pg_objects/parser.rb in pg_objects-0.4.2 vs lib/pg_objects/parser.rb in pg_objects-0.4.3
- old
+ new
@@ -6,13 +6,10 @@
#
# --!depends_on [name_of_dependency]
#
# name_of_dependency: short or full name of object as well as object_name
#
- # --!multistatement
- #
- # use when there are more than one SQL command in object file
class Parser
ROUTES = [
['DefineStmt', 'defnames', 0, 'String', 'str'],
['CreateFunctionStmt', 'funcname', 0, 'String', 'str'],
%w[CreateTrigStmt trigname],
@@ -25,12 +22,11 @@
].freeze
class << self
def fetch_directives(text)
{
- depends_on: fetch_dependencies(text),
- multistatement: fetch_multistatement(text)
+ depends_on: fetch_dependencies(text)
}
end
def fetch_object_name(text)
parsed = PgQuery.parse(text).tree.dig(0, 'RawStmt', 'stmt')
@@ -41,13 +37,9 @@
private
def fetch_dependencies(text)
text.split("\n").select { |ln| ln =~ /^(--|#)!/ }.map { |ln| ln.split(' ')[1] if ln =~ /!depends_on/ }.compact
- end
-
- def fetch_multistatement(text)
- text.split("\n").select { |ln| ln =~ /^(--|#)!/ }.select { |ln| ln =~ /!multistatement/ }.present?
end
end
end
end