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
Hiding Things in Ruby
Search
devpuppy
April 27, 2016
Technology
38
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Hiding Things in Ruby
Borrowing IIFE concept from Javascript to limit access using closures
devpuppy
April 27, 2016
Other Decks in Technology
See All in Technology
Temporal 最高!でも改めて「日付」について調べたら人類の負債すぎる件
riyaamemiya
0
150
スキマバイトという雇用形態は存在しないので、雇用期間1日のアルバイト契約を事業者とワーカーが結ぶ手続きを支えるのがタイミーなんです
akitoshiga
0
200
[JAWS-UG彩の国埼玉#12]そろそろ準備する?re:Invent2026をやさしく解説 / reinvent2026-sainokuni
sh_fk2
1
340
継続的なAIコスト最適化
bgpat
1
340
Getting Started with Google Antigravity
glaforge
0
310
ストレスなくAIと付き合いたい!こんなときどうしてる?
namiki64
3
530
Rust で関数型ドメインモデリング
takonda
0
140
今さら理解するウェブフォントver.2026
takanorip
3
810
USB PDを使ってスマホを労わりたい
raspython3
0
180
DGX Spark でどこまでハッキングができるのか?
kash1064
3
1.3k
サブエージェントと Claude Mods で作る独自 Advisor ツールの話
kenichiodo
2
160
TinyGoでオブザーバビリティ?OpenTelemetryはTinyGoで使えるのか / Is OpenTelemetry available in TinyGo environment?
ymotongpoo
2
140
Featured
See All Featured
Building Applications with DynamoDB
mza
96
7.2k
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
600
Building a Scalable Design System with Sketch
lauravandoore
464
34k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
530
Side Projects
sachag
456
43k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
540
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
750
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
430
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.8k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
530
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
20k
Transcript
@devpuppy Hiding Things IIFE Ruby
@devpuppy IIFE Immediately-Invoked Function Expression (pronounced “iffy”)
@devpuppy IIFE in JS var getNumber; var setNumber; (function() {
var number = 0; // lives inside the scope getNumber = function() { return number; } setNumber = function(value) { return number = value; } })();
@devpuppy
@devpuppy IIFE in Ruby get_number = nil set_number = nil
-> { number = 0 get_number = -> { number } set_number = ->(value) { number = value } }.()
@devpuppy
@devpuppy an Elevator in a building with no basement
@devpuppy class Elevator attr_accessor :floor def initialize @floor = 1
end # override setter to prevent basement def floor=(value) raise "No basement" if value.to_i < 1 @floor = value end end
@devpuppy
@devpuppy
@devpuppy class Elevator def initialize -> { floor = 1
define_singleton_method :floor= do |value| raise "No basement" if value.to_i < 1 floor = value end define_singleton_method :floor do floor end }.() end end
@devpuppy
@devpuppy Thanks!