Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Funky Ruby 🎉
Search
Caius
August 02, 2018
Programming
71
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Funky Ruby 🎉
Things you _can_ do in ruby, but _probably_ shouldn't let through code review
Caius
August 02, 2018
Other Decks in Programming
See All in Programming
phperだってパンチカードでコーディングしたい
o0h
PRO
0
330
外から家のPCの電源入れたい!をPHPで解決する
kawashimo0
1
130
ハーネス設計入門 〜 基礎知識の整理から実務へのステップアップ 〜
kinopeee
28
32k
ソニーのクラウド共通基盤の変遷とAI時代の開発スタイルに合わせた進化 / The Journey of Sony’s Common Cloud Platform and Its Evolution for AI-Native Development
kenjiyoneyama
0
270
月間100万人のサービス刷新で、 技術選定をHonoに振り切った話
yutobara
8
6.6k
残高管理から台帳サービスへの進化
artoy
1
200
re:Inventに行く前に知っておきたい現地参加のノウハウ
nokomoro3
0
420
sbt 2.0: takeoff
eed3si9n
0
160
Long Living Tokens, Die, Die, Die! (or: The One Ring is Banned in Modern)
sylph01
0
300
SREの越境 / SRE Collaboration
y0hgi
2
310
コードで差別化できない時代の ソフトウェアエンジニアリング / Software Engineering in an Era Where Code Doesn’t Differentiate
kishida
2
180
HTML-in-Canvasで作る未来のWeb UI表現
clockmaker
5
5.1k
Featured
See All Featured
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
260
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.2k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
940
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.9k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
232
55k
Discover your Explorer Soul
emna__ayadi
2
1.3k
エンジニアに許された特別な時間の終わり
watany
109
250k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
520
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
230
23k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
490
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
800
Transcript
! ! Funky Ruby Things you can do in ruby,
but probably shouldn't let through code review
_why the lucky stiff Try Ruby Why's (poignant) guide to
Ruby (foxes!) Camping (microframework! < 4kb) Hpricot
Why Day 19th August Keep it fun, keep it weird
Key " - Useful, okay # - Sometimes useful, usually
okay $ - Err, wtf㾗
" " String interpolation place = "plant" "We are in
#{place}" # => "We are in plant"
# # String interpolation @place = "plant" "We are in
#@place" # => "We are in plant"
# # String interpolation @pl = "pl" @ant = "ant"
"We are in #@pl#@ant" # => "We are in plant"
$ $ String interpolation @p = "p" @l = "l"
@a = "a" @n = "n" @t = "t" "We are in #@p#@l#@a#@n#@t" # => "We are in plant"
$ $ String interpolation %w(p l a n t).map {
|c| instance_variable_set("@#{c}", c) } "We are in #@p#@l#@a#@n#@t" # => "We are in plant"
$ $ String interpolation %w(e h r).map { |c| instance_variable_set("@#{c}",
c) } "We are #{"#@h#{"#{"#@e#{"#{"#@r#{"#{"#@e"}"}"}"}"}"}"}" # => "We are here"
" " String#% data = {name: "fred"} "I am %{name}"
% data # => "I am fred"
# # Kernel#method (3..5).map { |n| n + 10 }
# => [13, 14, 15] 10.method(:+) # => #<Method: Integer#+> (3..5).map(&10.method(:+)) # => [13, 14, 15]
" " Kernel#method Fence = Struct.new(:items) do def call items.map(&method(:fence_item))
end def fence_item(item) item.inspect end end
" " DATA require "yaml" YAML.load(DATA) # => ["Apples", "Crowbar",
"Sink Plunger"] __END__ # Shopping List - Apples - Crowbar - Sink Plunger
" " DATA DATA.rewind print DATA.read __END__ something goes here
" " UTF-8 Ruby def "Hi FreeAgent" end
# => "Hi FreeAgent"
" " UTF-8 Ruby : % # => : %
# # UTF-8 Ruby
$ $ UTF-8 Ruby class % end # => #
~> -:1: class/module name must be CONSTANT # ~> class % # ~> ^
$ $ UTF-8 Ruby % = Class.new # => #<Class:0x00007007>
% .new # => #<#<Class:0x00007007>:0x00007fe3>
$ $ UTF-8 Ruby & = Struct.new(: ' , :
( ) & .new("Caius", "00770090000") # => #<struct ' ="Caius", ="00770090000">
$ $ Glitch text
" " default method args def greet(name = :default) return
"Hello anon" if name == :default "Hello #{name}" end greet # => "Hello anon" greet "#nwrug" # => "Hello #nwrug" greet :default # => "Hello anon"
$ $ default method args def greet(name = (default =
true; :default)) if default "HAI" elsif name == :default "No. ) " else " * #{name}" end end
$ $ default method args greet # => "HAI" greet
"FreeAgent" # => "Hello FreeAgent" greet :default # => "No. "
Fin.
None