Class: RenameIndexFuncFilter

Inherits:
RenameTableFuncFilter show all
Defined in:
lib/func_filter.rb

Instance Attribute Summary

Attributes inherited from CreateTableFuncFilter

#column_option_str, #fclass, #func_option_str, #func_str

Instance Method Summary collapse

Methods inherited from RenameTableFuncFilter

#on_ident

Methods inherited from CreateTableFuncFilter

#add_tok, #on_default, #on_do_block, #on_float, #on_ident, #on_int, #on_kw, #on_lbrase, #on_nl, #on_rbrase, #on_tstring_beg, #on_tstring_end

Constructor Details

#initialize(src, fclass) ⇒ RenameIndexFuncFilter

Returns a new instance of RenameIndexFuncFilter.



515
516
517
518
519
520
521
# File 'lib/func_filter.rb', line 515

def initialize(src, fclass)
  super src, fclass

  @is_comma = false;
  @is_index = false
  @is_new_index = false
end

Instance Method Details

#on_comma(tok, f) ⇒ Object



535
536
537
538
539
# File 'lib/func_filter.rb', line 535

def on_comma(tok, f)
  @is_comma = true
  @is_index = true
  add_tok tok
end

#on_tstring_content(tok, f) ⇒ Object



523
524
525
526
527
528
529
530
531
532
533
# File 'lib/func_filter.rb', line 523

def on_tstring_content(tok, f)
  if @is_new_index && @is_comma
    @fclass.new_index_name = "'#{tok}'"
    @is_comma = false
  elsif @is_index && @is_comma
    @fclass.index_name = "'#{tok}'"
    @is_new_index = true
    @is_comma = false
  end
  add_tok tok
end