获取错误:./ http.rb:13:#(NoMethodError)的未定义方法`code'
#!/usr/bin/ruby
require 'rubygems'
require 'httparty'
class Foo
include HTTParty
end
# Simple get with full url
r = Foo.get('http://www.google.com/')
p r.code
答案 0 :(得分:0)
包含HTTParty也将指定模块的方法代码添加到Foo类。见mixin!
module HTTParty
module AllowedFormatsDeprecation
def get
#...
end
end
end
混合HTTParty到Foo应该工作