我确定我缺少一些基本的东西,因为我没有那么多使用红宝石。
我有这个类(为简单起见被截断):
require 'koala'
require 'time'
class FBRank
def initialize_with(access_token, photo_rank_weight=150, link_rank_weight=30, post_rank_weight=140, tagged_rank_weight=70, liked_photo_weight=150)
puts "hello?"
@graph_api = Koala::Facebook::API.new(access_token)
@photo_rank_weight = photo_rank_weight
@link_rank_weight = link_rank_weight
@post_rank_weight = post_rank_weight
@tagged_rank_weight = tagged_rank_weight
@liked_photo_weight = liked_photo_weight
end
end
然后我:
:young-waters-3693[104] > irb
1.9.3p429 :002 > require './ranking'
1.9.3p429 :002 > FBRank.initialize_with('CAAJzb7....')
NoMethodError: undefined method `initialize_with' for FBRank:Class
我没有正确实例化什么?我尝试创建一个作为此类实例的对象,但这也不起作用,但这可能是因为我做错了......