Use ruby_block for the parts that need to be execute time

Change-Id: I67c20b69395d9934224fc930e5b872d2ad40907e