- Ruby For Dummies
- Ruby Cheatsheet Pdf
- Ruby Cheat Sheet
Ruby, Go cheat sheet. Idiom ID Imports Comments Links Only entries having Ruby Only entries having Go The snippets are under the CC-BY-SA license. Consider printing in landscape mode; or not printing at all, and keeping a bookmark. Ruby cheatsheet This is a cheatsheet for Ruby beginners and contains links to resources and some simple examples to get started with Ruby. 0 Comments for this cheatsheet. Devhints.io / Over 352 curated cheatsheets, by developers for developers. Devhints home Other Ruby libraries cheatsheets. Factory Bot cheatsheet Meta-tags gem cheatsheet Ronn cheatsheet Slim cheatsheet Chunky PNG.
- PDF Link: cheatsheet-ruby-A4.pdf, Category: languages
- Blog URL: https://cheatsheet.dennyzhang.com/cheatsheet-ruby-A4
- Related posts: Golang CheatSheet, Python CheatSheet, #denny-cheatsheets
File me Issues or star this repo. P60 antutu.
1.1 Summary
Name | Comment |
---|
Check syntax | ruby -c my.rb |
Generate random key | r = Random.new, r.rand(10..42) |
Install ruby 2.4 | GitHub: Ubuntu install ruby 2.4 |
Install package with specific version | gem install rubocop -v '0.44.1' |
Install package with a range of versions | gem install rails -v '~>4.0.0' |
Install package with a range of versions | gem install rails -v '>3.1, <4.1' |
Get RubyGem env | gem env |
Check whether variable is nil | if value.nil? |
Run system command | system('commandhere') |
Run bash command | stdin, stdout, stderr = Open3.popen3('ls .') |
1.2 List
Name | Comment |
---|
Check existence | [‘Cat', ‘Dog', ‘Bird'].include? ‘Dog' |
Find item | l1.find_index(x) |
Remove item from list | l1.delete_at(2) |
Remove duplicate entries | [1,2,2,1,4,4,5,6,7,8,5,6].uniq |
Deep copy a list | l1=l.dup |
1.3 String
Name | Comment |
---|
Substring | string[1.3] |
Search substring | 'option=name=bob'.index('name') |
Replace | 'Welcome to PHP Essentials!'.gsub('PHP', 'Ruby') |
Remove trailing comma | 'ab;123;'.chomp(';') |
Strip whitespace | host = host.strip() |