如果我能用Ruby做到这一点会不会很好?
SET IDENTITY_INSERT MYTABLE ON
/*insert your records*/
SET IDENTITY_INSERT MYTABLE OFF
但我不能。
class Type
attr_accessor :weak_against, :strong_against
def initialize(weak_against, strong_against)
@weak_against = weak_against
@strong_against = strong_against
end
end
Fire = Type.new([Water], [Grass])
Water = Type.new([Grass], [Fire])
Grass = Type.new([Fire], [Water])
有人知道解决方法吗?
答案 0 :(得分:2)
这样可行:
class Type
attr_accessor :weak_against, :strong_against
end
Fire = Type.new
Water = Type.new
Grass = Type.new
Fire.weak_against = Water
Fire.strong_against = Grass
Water.weak_against = Grass
Water.strong_against = Fire
Grass.weak_against = Fire
Grass.strong_against = Water