slight modify on ruby snippets