adding ruby method called by objective-c and fixing loop counter