class SQLtorial::RegexpDirective

Constants

REGEXP

Attributes

column[RW]

Public Class Methods

new(line) click to toggle source
# File lib/sqltorial/regexp_directive.rb, line 13
def initialize(line)
  _, column, op, matcher = REGEXP.match(line).to_a
  @column = column.to_sym
  @op = op
  @matcher = Regexp.new(matcher)
end
regexp() click to toggle source
# File lib/sqltorial/regexp_directive.rb, line 7
def regexp
  REGEXP
end

Public Instance Methods

inspect() click to toggle source
# File lib/sqltorial/regexp_directive.rb, line 25
def inspect
  [column, op, matcher].join(" ")
end
validate(result) click to toggle source
# File lib/sqltorial/regexp_directive.rb, line 20
def validate(result)
  md = matcher.match(result[column])
  op == '=' ? !md.nil? : md.nil?
end