fix missed const

Change-Id: I9ba10c94969901e25bdb480059df7400a24f9ff2
more refactoring in switch/base.rb

Change-Id: I6efb31fb59454f4c7ab45c5fd08622b4886dc41b