Class: ImportEverything::SqlInsertParser::LineParser

Inherits:
LineParser show all
Extended by:
MethodLogging
Includes:
FromHash
Defined in:
lib/import_everything/parsers/sql_parser.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Methods included from MethodLogging

def_logging_method, log_method

Methods inherited from LineParser

#row_hashes, #value_hashes

Instance Attribute Details

#lineObject

Returns the value of attribute line.



32
33
34
# File 'lib/import_everything/parsers/sql_parser.rb', line 32

def line
  @line
end

Class Method Details

.comment?(str) ⇒ Boolean

Returns:

  • (Boolean)


54
55
56
# File 'lib/import_everything/parsers/sql_parser.rb', line 54

def comment?(str)
  !!(str =~ comment_regex)
end

.probable_insert?(str) ⇒ Boolean

Returns:

  • (Boolean)


46
47
48
49
50
# File 'lib/import_everything/parsers/sql_parser.rb', line 46

def probable_insert?(str)
  str = str.strip
  res = (str =~ insert_into_regex) && !comment?(str)
  !!res
end

.valid_insert?(str) ⇒ Boolean

Returns:

  • (Boolean)


51
52
53
# File 'lib/import_everything/parsers/sql_parser.rb', line 51

def valid_insert?(str)
  !!(str =~ full_regex)
end