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
value_struct
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
J-_-L
November 03, 2012
Technology
100
2
Share
value_struct
5-min introduction to read-only structs in Ruby
J-_-L
November 03, 2012
More Decks by J-_-L
See All by J-_-L
Why Ruby is "beautiful code"!
janlelis
2
2.2k
Other Decks in Technology
See All in Technology
さきさん文庫の書籍ができるまで
sakiengineer
0
330
美味しいスイスチーズを作ろう🧀🐭
taigamikami
1
220
AI フレンドリーなエラー監視を TypeScript で実現する
shinyaigeek
2
210
Dynamic Workersについて
yusukebe
2
560
BigQuery の Cross-cloud Lakehouse への歩み
phaya72
2
330
JEP 522 Deep Dive - G1 GC同期コスト削減によるスループット向上を徹底検証&解説
tabatad
1
600
AI活用を推進するために ファインディが下した、一つの小さな決断
starfish719
0
120
ChatworkとBPaaS 異なる特性で学んだAI機能開発の ベストプラクティス
kubell_hr
2
1.4k
Platform Engineering as a Product: Criteria for Improvement and Multi-Tenant Design
kumorn5s
0
460
脅威をエンジニアリングの糧にして:恐怖を乗り越えた先にあったもの / Turn threats into fuel for engineering: what lay beyond overcoming fear
nrslib
1
370
速さだけじゃない! VoidZero ツールが移行先に選ばれる理由
mizdra
PRO
6
730
long-running-tasks
cipepser
3
460
Featured
See All Featured
Building Flexible Design Systems
yeseniaperezcruz
330
40k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
Building Applications with DynamoDB
mza
96
7.1k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.5k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
170
Measuring & Analyzing Core Web Vitals
bluesmoon
9
850
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
290
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
570
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.5k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
380
Done Done
chrislema
186
16k
Transcript
1/6 rbjl.net ValueStruct - Nov 3 2012 - Jan Lelis
d:evolute @happycode
2/6 rbjl.net ValueStruct Value structs behave like a normal Ruby
structs However, they are immutable*
3/6 rbjl.net ValueStruct: First Draft
4/6 rbjl.net ValueStruct: Benchmarks • Without mixins not much slower
than Struct
5/6 rbjl.net ValueStruct: Optional mixins • #dup takes a optional
hash for setting new values • Value structs can be initialized with the exact amount of arguments • Automatically freeze new instances • #to_h for converting into a hash • If Ruby version below 2.0
6/6 rbjl.net ValueStruct: Resources • gem install value_struct • https://github.com/janlelis/value_struct
• Other solutions • https://github.com/tcrayford/Values • https://github.com/iconara/immutable_struct • Twitter • @happycode • Contact • happycode.org / devolute.org