Class: RemoveIndexFuncFilter
- Inherits:
-
Ripper::Filter
- Object
- Ripper::Filter
- RemoveIndexFuncFilter
- Defined in:
- lib/func_filter.rb
Instance Attribute Summary collapse
-
#fclass ⇒ Object
Returns the value of attribute fclass.
-
#func_str ⇒ Object
Returns the value of attribute func_str.
Instance Method Summary collapse
- #add_tok(tok) ⇒ Object
-
#initialize(src, fclass) ⇒ RemoveIndexFuncFilter
constructor
A new instance of RemoveIndexFuncFilter.
- #on_default(event, tok, f) ⇒ Object
- #on_ident(tok, f) ⇒ Object
- #on_lbracket(tok, f) ⇒ Object
- #on_rbracket(tok, f) ⇒ Object
- #on_tstring_content(tok, f) ⇒ Object
Constructor Details
#initialize(src, fclass) ⇒ RemoveIndexFuncFilter
Returns a new instance of RemoveIndexFuncFilter.
463 464 465 466 467 468 469 470 471 |
# File 'lib/func_filter.rb', line 463 def initialize(src, fclass) super src @fclass = fclass @func_str = '' @is_columns = false @columns = '' @is_name = false end |
Instance Attribute Details
#fclass ⇒ Object
Returns the value of attribute fclass.
461 462 463 |
# File 'lib/func_filter.rb', line 461 def fclass @fclass end |
#func_str ⇒ Object
Returns the value of attribute func_str.
461 462 463 |
# File 'lib/func_filter.rb', line 461 def func_str @func_str end |
Instance Method Details
#add_tok(tok) ⇒ Object
473 474 475 476 477 478 |
# File 'lib/func_filter.rb', line 473 def add_tok(tok) if @is_columns @columns += tok end @func_str += tok end |
#on_default(event, tok, f) ⇒ Object
480 481 482 |
# File 'lib/func_filter.rb', line 480 def on_default(event, tok, f) add_tok tok end |
#on_ident(tok, f) ⇒ Object
484 485 486 487 488 489 490 491 492 |
# File 'lib/func_filter.rb', line 484 def on_ident(tok, f) if tok == 'name' @is_name = true @is_columns = false elsif tok == 'column' @is_name = false end add_tok tok end |
#on_lbracket(tok, f) ⇒ Object
501 502 503 504 |
# File 'lib/func_filter.rb', line 501 def on_lbracket(tok, f) @is_columns = true add_tok tok end |
#on_rbracket(tok, f) ⇒ Object
506 507 508 509 510 |
# File 'lib/func_filter.rb', line 506 def on_rbracket(tok, f) add_tok tok @fclass.option.set_option('column', @columns) @is_columns = false end |
#on_tstring_content(tok, f) ⇒ Object
494 495 496 497 498 499 |
# File 'lib/func_filter.rb', line 494 def on_tstring_content(tok, f) if @is_name @fclass.option.set_option('name', "'#{tok}'") end add_tok tok end |