def _check_ruby(ret, ruby, user=None):
 match_version = True
 match_micro_version = False
 micro_version_regex = re.compile('-([0-9]{4}\\.[0-9]{2}|p[0-9]+)$')
 if micro_version_regex.search(ruby):
  match_micro_version = True
 if re.search('^[a-z]+$', ruby):
  match_version = False
 ruby = re.sub('^ruby-', '', ruby)
 for (impl, version, default) in __salt__['rvm.list'](runas=user):
  if (impl != 'ruby'):
   version = '{impl}-{version}'.format(impl=impl, version=version)
  if (not match_micro_version):
   version = micro_version_regex.sub('', version)
  if (not match_version):
   version = re.sub('-.*', '', version)
  if (version == ruby):
   ret['result'] = True
   ret['comment'] = 'Requested ruby exists.'
   ret['default'] = default
   break
 return ret

def _check_ruby ( ret , ruby , user = None ) : match_version = True match_micro_version = False micro_version_regex = re . compile ( '-([0-9]{4}\\.[0-9]{2}|p[0-9]+)$' ) if micro_version_regex . search ( ruby ) : match_micro_version = True if re . search ( '^[a-z]+$' , ruby ) : match_version = False ruby = re . sub ( '^ruby-' , '' , ruby ) for ( impl , version , default ) in __salt__ [ 'rvm.list' ] ( runas = user ) : if ( impl != 'ruby' ) : version = '{impl}-{version}' . format ( impl = impl , version = version ) if ( not match_micro_version ) : version = micro_version_regex . sub ( '' , version ) if ( not match_version ) : version = re . sub ( '-.*' , '' , version ) if ( version == ruby ) : ret [ 'result' ] = True ret [ 'comment' ] = 'Requested ruby exists.' ret [ 'default' ] = default break return ret
check that ruby is installed .