class Safrano::TypeMapping::Builder2Par

Public Class Methods

new(db_ty_rgx, proc) click to toggle source
# File lib/safrano/type_mapping.rb, line 101
def initialize(db_ty_rgx, proc)
  @db_types_rgx = db_ty_rgx
  @proc = proc
  @rgx = /\A\s*(?:#{@db_types_rgx})\s*\(\s*(\d+)\s*,\s*(\d+)\s*\)\s*\z/i
end

Public Instance Methods

match(curtyp) click to toggle source
# File lib/safrano/type_mapping.rb, line 107
def match(curtyp)
  (@md = @rgx.match(curtyp)) ? type_mapping : nil
end
type_mapping() click to toggle source

probably this is not best-practice programing as we have a mutating object (the builder) that produces different lambdas after each type_mapping(mutation) calls

# File lib/safrano/type_mapping.rb, line 120
def type_mapping
  p1val = @md[1]
  p2val = @md[2]
  instance_exec p1val, p2val, &@proc
  TypeMapping2Par.new(self)
end