Module: RubyLanguageServer::ScopeParserCommands::RailsCommands
- Included in:
- RubyLanguageServer::SEXPProcessor
- Defined in:
- lib/ruby_language_server/scope_parser_commands/rails_commands.rb
Instance Method Summary collapse
- #rails_add_reference(line, args, rest) ⇒ Object (also: #on_has_one_command, #on_has_many_command, #on_belongs_to_command, #on_has_and_belongs_to_many_command, #on_scope_command, #on_named_scope_command)
Instance Method Details
#rails_add_reference(line, args, rest) ⇒ Object Also known as: on_has_one_command, on_has_many_command, on_belongs_to_command, on_has_and_belongs_to_many_command, on_scope_command, on_named_scope_command
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/ruby_language_server/scope_parser_commands/rails_commands.rb', line 6 def rails_add_reference(line, args, rest) # args: [:@ident, "has_one", [2, 2]] # rest: [[:args_add_block, [[:symbol_literal, [:symbol, [:@ident, "bar", [2, 11]]]]], false]] # Looks like the first string is gonna be the name (_, _, (_, column)) = args name = rest.flatten.detect { |o| o.instance_of? String } [name, "#{name}="].each do |method_name| push_scope(RubyLanguageServer::ScopeData::Base::TYPE_METHOD, method_name, line, column) process(rest) pop_scope end end |