Module: SchemaProcs

Constant Summary collapse

@@_cascade_or_restrict =
Proc.new {|which| which     ? 'CASCADE' : 'RESTRICT' }
@@_strict_or_null =
Proc.new {|strict| strict   ? 'STRICT' : 'CALLED ON NULL INPUT' }
@@_definer_or_invoker =
Proc.new {|definer| definer ? 'DEFINER' : 'INVOKER' }
@@_behavior =
Proc.new {|volatile| %w{immutable stable volatile}.grep(/^#{volatile[0,1]}.+/).to_s }

Instance Method Summary collapse

Instance Method Details

#behavior(volatile = 'v') ⇒ Object



16
17
18
# File 'lib/schema_procs.rb', line 16

def behavior(volatile='v')
  @@_behavior.call(volatile)
end

#cascade_or_restrict(cascade = false) ⇒ Object



7
8
9
# File 'lib/schema_procs.rb', line 7

def cascade_or_restrict(cascade=false)
  @@_cascade_or_restrict.call(cascade)
end

#definer_or_invoker(definer = false) ⇒ Object



13
14
15
# File 'lib/schema_procs.rb', line 13

def definer_or_invoker(definer=false)
  @@_definer_or_invoker.call(definer)
end

#strict_or_null(is_strict = false) ⇒ Object



10
11
12
# File 'lib/schema_procs.rb', line 10

def strict_or_null(is_strict=false)
  @@_strict_or_null.call(is_strict)
end