我正在尝试在 IRB 工作以了解我在网上找到的一些代码。
我能够要求最终导入此文件的文件:
module LinkedIn
module Api
logger.debug "....7"
module QueryMethods
logger.debug "....6"
def profile(options={})
logger.debug "....1"
path = person_path(options)
simple_query(path, options)
end
def connections(options={})
path = "#{person_path(options)}/connections"
simple_query(path, options)
end
def network_updates(options={})
path = "#{person_path(options)}/network/updates"
simple_query(path, options)
end
def company(options = {})
path = company_path(options)
simple_query(path, options)
end
def test(options = {})
logger.debug "helllllooooo"
end
private
logger.debug "....2"
def simple_query(path, options={})
logger.debug "....3"
fields = options.delete(:fields) || LinkedIn.default_profile_fields
if options.delete(:public)
path +=":public"
elsif fields
path +=":(#{fields.map{ |f| f.to_s.gsub("_","-") }.join(',')})"
end
headers = options.delete(:headers) || {}
params = options.map { |k,v| "#{k}=#{v}" }.join("&")
path += "?#{params}" if not params.empty?
Mash.from_json(get(path, headers))
end
def person_path(options)
logger.debug "....4"
path = "/people/"
if id = options.delete(:id)
path += "id=#{id}"
elsif url = options.delete(:url)
path += "url=#{CGI.escape(url)}"
else
path += "~"
end
end
def company_path(options)
path = "/companies/"
if id = options.delete(:id)
path += "id=#{id}"
elsif url = options.delete(:url)
path += "url=#{CGI.escape(url)}"
elsif name = options.delete(:name)
path += "universal-name=#{CGI.escape(name)}"
elsif domain = options.delete(:domain)
path += "email-domain=#{CGI.escape(domain)}"
else
path += "~"
end
end
end
end
end
这段代码是 LinkedIn 的包装器,我在这里找到了它:https ://github.com/pengwynn/linkedin/blob/master/lib/linked_in/api/query_methods.rb
它大部分是现成的,但这个测试位是我的:
def test(options = {})
logger.debug "helllllooooo"
end
我在本地复制了这些文件,在 IRB 中我可以执行一些命令,但由于某种原因我不能做类似的事情,client.test
而我可以做类似client.profile
.
也没有任何调试语句出现在 IRB 中。我是否必须使用某种标志启动 IRB 才能看到调试?