RubyMine IDE中软件包的ruby方法的下拉列表? [英] Dropdown list for ruby methods of a package in RubyMine IDE?

查看:92
本文介绍了RubyMine IDE中软件包的ruby方法的下拉列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通常,在IDE中的下拉列表是通过在导入包并键入其名称后按Tab键显示的,而不是在RubyMine中显示的.我已经模拟了Vim.我打开了交互式红宝石外壳irb,但无法使自动完成功能适用于包的方法.

Usually, the dropdown list in IDEs appear by pressing tab after importing the package and typing its names but not in RubyMine. I have Vim emulation on. I opened up the interactive ruby shell irb but cannot get the autocompletion working for the methods of a package.

自动完成功能如何在RubyMine中工作以及如何列出包的方法(例如OAuth)?

推荐答案

RubyMine自动补全的工作原理是完成整个项目中使用的名称和关键字,请参见这个问题,该问题可以使人清楚在RubyMine中工作如何完成.

The RubyMine autocompletion works mostly by completing names and keywords used throughout the project see here for some details on how that works. There is also this question that may provide some clarity as to how completion works in RubyMine.

关于在包中列出可用方法的问题(实际上在任何对象中).您可以使用方法.methods来获取对象响应的方法数组. 由于红宝石的动态性质和可能性工具method_missing,因此列表可能未包含所有可能的方法 .

As for the question about listing available methods in a package (in any object, really). You can use the method .methods to get an array of methods the object responds to. due to the dynamic nature of ruby and the possibility implement method_missing, the list may not contain all possible methods.

这是一个例子

"string".methods
#=> [:include?, :%, :*, :+, :to_c, :count, :unicode_normalize, :unicode_normalize!, :unicode_normalized?, :partition, :unpack, :unpack1, :sum, :next, :casecmp, :casecmp?, :insert, :bytesize, :match, :match?, :succ!, :+@, :-@, :index, :rindex, :<=>, :replace, :clear, :upto, :getbyte, :==, :===, :setbyte, :=~, :scrub, :[], :[]=, :chr, :scrub!, :dump, :byteslice, :upcase, :next!, :empty?, :eql?, :downcase, :capitalize, :swapcase, :upcase!, :downcase!, :capitalize!, :swapcase!, :hex, :oct, :split, :lines, :reverse, :chars, :codepoints, :prepend, :bytes, :concat, :<<, :freeze, :inspect, :intern, :end_with?, :crypt, :ljust, :reverse!, :chop, :scan, :gsub, :ord, :start_with?, :length, :size, :rstrip, :succ, :center, :sub, :chomp!, :sub!, :chomp, :rjust, :lstrip!, :gsub!, :chop!, :strip, :to_str, :to_sym, :rstrip!, :tr, :tr_s, :delete, :to_s, :to_i, :tr_s!, :delete!, :squeeze!, :each_line, :squeeze, :strip!, :each_codepoint, :lstrip, :slice!, :rpartition, :each_byte, :each_char, :to_f, :slice, :ascii_only?, :encoding, :force_encoding, :b, :valid_encoding?, :tr!, :encode, :encode!, :hash, :to_r, :<, :>, :<=, :>=, :between?, :clamp, :instance_of?, :kind_of?, :is_a?, :tap, :public_send, :remove_instance_variable, :singleton_method, :instance_variable_set, :define_singleton_method, :method, :public_method, :extend, :to_enum, :enum_for, :!~, :respond_to?, :object_id, :send, :display, :nil?, :class, :singleton_class, :clone, :dup, :itself, :taint, :tainted?, :untaint, :untrust, :untrusted?, :trust, :frozen?, :methods, :singleton_methods, :protected_methods, :private_methods, :public_methods, :instance_variable_get, :instance_variables, :instance_variable_defined?, :!, :!=, :__send__, :equal?, :instance_eval, :instance_exec, :__id__]

有关更有用的列表,您可能希望删除从Object继承的方法,如

for a more useful list, you may want to remove methods that are inherited from Object, like so

"string".methods - Object.methods
#=>  [:%, :*, :+, :to_c, :count, :unicode_normalize, :unicode_normalize!, :unicode_normalized?, :partition, :unpack, :unpack1, :sum, :next, :casecmp, :casecmp?, :insert, :bytesize, :match, :match?, :succ!, :+@, :-@, :index, :rindex, :replace, :clear, :upto, :getbyte, :setbyte, :scrub, :[], :[]=, :chr, :scrub!, :dump, :byteslice, :upcase, :next!, :empty?, :downcase, :capitalize, :swapcase, :upcase!, :downcase!, :capitalize!, :swapcase!, :hex, :oct, :split, :lines, :reverse, :chars, :codepoints, :bytes, :concat, :<<, :intern, :end_with?, :crypt, :ljust, :reverse!, :chop, :scan, :gsub, :ord, :start_with?, :length, :size, :rstrip, :succ, :center, :sub, :chomp!, :sub!, :chomp, :rjust, :lstrip!, :gsub!, :chop!, :strip, :to_str, :to_sym, :rstrip!, :tr, :tr_s, :delete, :to_i, :tr_s!, :delete!, :squeeze!, :each_line, :squeeze, :strip!, :each_codepoint, :lstrip, :slice!, :rpartition, :each_byte, :each_char, :to_f, :slice, :ascii_only?, :encoding, :force_encoding, :b, :valid_encoding?, :tr!, :encode, :encode!, :to_r, :between?, :clamp]

根据您的情况,您可能要致电OAuth.methods - Object.methods

in your case, you may want to call OAuth.methods - Object.methods

有关methods方法的更多信息此处

这篇关于RubyMine IDE中软件包的ruby方法的下拉列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆