我有這樣一個偉大的一些方法:圍繞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或其他重量級的東西。