我正在将以下代码段从我的文本编辑器复制到我的 rails 控制台:
request = Typhoeus::Request.new(
"https://track.customer.io/api/v1/customers/4",
ssl_verifypeer: false,
method: :put,
headers: {
"Content-Type" => "application/json",
"User-Agent" => "#{Rails.configuration.customerio[:site_id]}:#{Rails.configuration.customerio[:api_key]}"},
body: '{
"email":"first@last.com",
"name":"Name is here",
"id":"4",
"created_at":"#{Time.now}"}')
当我将它们全部复制为一行时:
request = Typhoeus::Request.new("https://track.customer.io/api/v1/customers/4", ssl_verifypeer: false,method: :put,headers: {"Content-Type" => "application/json","User-Agent" => "#{Rails.configuration.customerio[:site_id]}:#{Rails.configuration.customerio[:api_key]}"},body: '{"email":"first@last.com", "name":"Name is here","id":"4","created_at":"#{Time.now}"}')
然后控制台返回标准响应:
=> #<Typhoeus::Request:0x00000101c517a8 @base_url="https://track.customer.io/api/v1/customers/4", @original_options=...
但是,如果我逐行复制它(就像我在第一个代码片段中所做的那样),我会收到一个奇怪的错误。控制台询问我是否要显示所有可能性,就好像我正在搜索目录或在粘贴过程中进行搜索查询一样。看看这个:
1.9.3p393 :091 > request = Typhoeus::Request.new(
1.9.3p393 :092 > "https://track.customer.io/api/v1/customers/4",
1.9.3p393 :093 > ssl_verifypeer: false,
1.9.3p393 :094 > method: :put,
1.9.3p393 :095 > headers: {
1.9.3p393 :096 >
Display all 573 possibilities? (y or n)
1.9.3p393 :096 > "Content-Type" => "application/json",
1.9.3p393 :097 >
Display all 573 possibilities? (y or n)
1.9.3p393 :097 > "User-Agent" => "#{Rails.configuration.customerio[:site_id]}:#{Rails.configuration.customerio[:api_key]}"},
1.9.3p393 :098 > body: '{
1.9.3p393 :099'> "email":"first@last.com",
1.9.3p393 :100'> "name":"Name is here",
1.9.3p393 :101'> "id":"4",
1.9.3p393 :102'> "created_at":"#{Time.now}"}')
如果我n
两次都选择,则请求将正常创建。但是,如果我选择y
,它会列出 573 个项目,其中大部分是我放入这个馅饼的:http: //pastie.org/private/ksgzqhd50mvdi0t6cqe8g
你知道这些结果是什么,更重要的是,为什么会在这个奇怪的时间提示它们?