Module: Ripper::RubyBuilder::Const
- Included in:
- Ripper::RubyBuilder
- Defined in:
- lib/ripper/ruby_builder/events/const.rb
Instance Method Summary collapse
- #on_class(const, super_class, body) ⇒ Object
- #on_const_path_field(namespace, const) ⇒ Object
- #on_const_path_ref(namespace, const) ⇒ Object
- #on_module(const, body) ⇒ Object
- #on_sclass(super_class, body) ⇒ Object
- #on_top_const_field(const) ⇒ Object
- #on_top_const_ref(const) ⇒ Object
Instance Method Details
#on_class(const, super_class, body) ⇒ Object
4 5 6 7 8 9 |
# File 'lib/ripper/ruby_builder/events/const.rb', line 4 def on_class(const, super_class, body) rdelim = pop_token(:@end) operator = super_class ? pop_token(:'@<') : nil ldelim = pop_token(:@class) Ruby::Class.new(const, operator, super_class, body, ldelim, rdelim) end |
#on_const_path_field(namespace, const) ⇒ Object
30 31 32 33 34 |
# File 'lib/ripper/ruby_builder/events/const.rb', line 30 def on_const_path_field(namespace, const) const.prolog.unshift(pop_token(:'@::')) const.namespace = namespace const end |
#on_const_path_ref(namespace, const) ⇒ Object
24 25 26 27 28 |
# File 'lib/ripper/ruby_builder/events/const.rb', line 24 def on_const_path_ref(namespace, const) const.prolog.unshift(pop_token(:'@::')) const.namespace = namespace const end |
#on_module(const, body) ⇒ Object
18 19 20 21 22 |
# File 'lib/ripper/ruby_builder/events/const.rb', line 18 def on_module(const, body) rdelim = pop_token(:@end) ldelim = pop_token(:@module) Ruby::Module.new(const, body, ldelim, rdelim) end |
#on_sclass(super_class, body) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/ripper/ruby_builder/events/const.rb', line 11 def on_sclass(super_class, body) rdelim = pop_token(:@end) operator = pop_token(:'@<<') ldelim = pop_token(:@class) Ruby::Class.new(nil, operator, super_class, body, ldelim, rdelim) end |
#on_top_const_field(const) ⇒ Object
41 42 43 44 |
# File 'lib/ripper/ruby_builder/events/const.rb', line 41 def on_top_const_field(const) const.prolog.unshift(pop_token(:'@::')) const end |
#on_top_const_ref(const) ⇒ Object
36 37 38 39 |
# File 'lib/ripper/ruby_builder/events/const.rb', line 36 def on_top_const_ref(const) const.prolog.unshift(pop_token(:'@::')) const end |