Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Ruby One-Liners
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
bjelli
March 23, 2012
Programming
1
340
Ruby One-Liners
A lightning talk at Salzburg Barcamp "The Next Web" in March 2012.
bjelli
March 23, 2012
Tweet
Share
More Decks by bjelli
See All by bjelli
Intro to Web- and Mobile-Developement
bjelli
0
320
Railsgirls: Where did my HTML and CSS go
bjelli
0
580
Berufe im World Wide Web
bjelli
0
260
Javascript Closures
bjelli
3
900
Teach (all the) Rails
bjelli
0
440
Other Decks in Programming
See All in Programming
OSSとなったswift-buildで Xcodeのビルドを差し替えられるため 自分でXcodeを直せる時代になっている ダイアモンド問題編
yimajo
3
610
CSC307 Lecture 01
javiergs
PRO
0
690
今から始めるClaude Code超入門
448jp
8
8.6k
dchart: charts from deck markup
ajstarks
3
990
360° Signals in Angular: Signal Forms with SignalStore & Resources @ngLondon 01/2026
manfredsteyer
PRO
0
120
Lambda のコードストレージ容量に気をつけましょう
tattwan718
0
110
登壇資料を作る時に意識していること #登壇資料_findy
konifar
4
1k
AI & Enginnering
codelynx
0
110
インターン生でもAuth0で認証基盤刷新が出来るのか
taku271
0
190
CSC307 Lecture 02
javiergs
PRO
1
770
Honoを使ったリモートMCPサーバでAIツールとの連携を加速させる!
tosuri13
1
170
コントリビューターによるDenoのすゝめ / Deno Recommendations by a Contributor
petamoriken
0
200
Featured
See All Featured
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
110
Building Flexible Design Systems
yeseniaperezcruz
330
40k
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
0
140
Believing is Seeing
oripsolob
1
53
GraphQLとの向き合い方2022年版
quramy
50
14k
A Soul's Torment
seathinner
5
2.2k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
3.9k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
730
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
170
Become a Pro
speakerdeck
PRO
31
5.8k
Deep Space Network (abreviated)
tonyrice
0
47
Transcript
Ruby One-Liner
mit -e Programmcode angeben ruby -e ' puts "hello" '
ruby -e 'puts "Hello"' mit -e Programm angeben
ruby -e 'puts 24 * 60 * 60 ' mein
Taschenrechner
ruby -p -e '' langer.txt -p print-schleife über datei
ruby -p -e 'puts' langer.txt leerzeile nach jeder zeile
ruby -p -e 'puts $_.length' langer.txt $_ enthält die Zeile
ruby -p -e 'puts "#{$.}.Zeile hat länge #{$_.length} " '
langer.txt $. enthält die Zeilennummer
Korrektur • es geht nicht um Zeilen • sondern um
"Records" • default: Record-Separator ist "\n" • deswegen wird zeilenweise gelesen • Der Separator ist in der Variable $/
ruby -00 -p -e 'puts "#{$.}.Absatz hat länge #{$_.length} "
' l.txt -00 verwende doppelten separator Absatz statt Zeile
ruby -p -e 'puts "."' index.html -n schleif, nicht ausgeben
ruby -n -e 'puts if /Schokolade/' index.html Finden grep
ruby -p -e 'gsub(/Game/, "Web")' index.html Ersetzen
ruby -i.bak -p -e 'gsub(/Game/, "Web")' index.html Ersetzen in der
Datei neu in index.html, alt in index.html.bak
ruby -i.bak -p -e 'gsub(/Game/, "Web")' *.html Ersetzen in vielen
Dateien
ruby command line switches + ruby one-liners + unix |
Learn More