Module: ColName

Defined in:
lib/analyzer.rb

Class Method Summary collapse

Class Method Details

.fix_numbers(col_name) ⇒ Object



347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
# File 'lib/analyzer.rb', line 347

def self.fix_numbers col_name
  matches=(col_name.scan /(\d)/)
  if matches==[]
    puts "no match"
    return col_name
  else 
    n=matches[0]
    puts "captures #{n} #{n.class}"
    case n
    when "1"
      puts n
      col_name.gsub!(n,"one")
    when "2"
      puts n
      col_name.gsub!(n,"two")
    when "3"
      puts n
      col_name.gsub!(n,"three")
    when "4"
      puts n
      col_name.gsub!(n,"four")
    when "5"
      puts n
      col_name.gsub!(n,"five")
    when "6"
      puts n
      col_name.gsub!(n,"six")
    when "7"
      puts n
      col_name.gsub!(n,"seven")
    when "8"
      puts n
      col_name.gsub!(n,"eight")
    when "9"
      puts n
      col_name.gsub!(n,"nine")
    end
  end
  col_name
end

.fix_spaces(col_name) ⇒ Object



343
344
345
# File 'lib/analyzer.rb', line 343

def self.fix_spaces col_name
  col_name.gsub(".","_").gsub(" ","_")
end