我有这样一个伟大的一些方法:围绕Ruby方法的代码
def enableMotors
@posIface.Lock 1
@posIface.data.cmdEnableMotors = 1
@posIface.Unlock
end
def goTo (pos)
@posIface.Lock 1
@posIface.data.cmdVelocity.pos = pos
@posIface.Unlock
end
我想创建功能:的before_filter和:after_filter或任何其他方式我能保持这样的代码尽可能干燥。 我不想只依赖于Rails或其他重量级的东西。