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
Block_is_everywhere.pdf
Search
Masafumi Okura
December 11, 2019
Programming
110
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Block_is_everywhere.pdf
Masafumi Okura
December 11, 2019
More Decks by Masafumi Okura
See All by Masafumi Okura
Ruby for complete beginners
okuramasafumi
1
210
Conference as a communication hub for all of us
okuramasafumi
0
110
Metaprogramming isn't real, it can't hurt you
okuramasafumi
0
190
Developing static sites with Ruby
okuramasafumi
1
480
Why doesn't Ruby have Boolean class - final version
okuramasafumi
0
430
Reading Rails 1.0 Source Code
okuramasafumi
0
400
RDoc meets YARD
okuramasafumi
4
290
Why doesn't Ruby have Boolean class?
okuramasafumi
0
82
My KaigiEffect at RubyKaigi 2025, part 1
okuramasafumi
1
120
Other Decks in Programming
See All in Programming
Security issues being discussed on Web Platforms
petamoriken
0
1.2k
世界の中心で、AI(App Intents)をさけぶ ー App Intents中心設計の実践ガイド
touyou
0
650
The Rails Doctrine Decade
koic
2
310
ゲームコントローラやキーボードのファームウェアをSwiftで書く
kishikawakatsumi
1
250
What We Talk About When We Talk About XP
m_seki
2
670
大喜利で理解するLLM as a Judge / Understanding LLM-as-a-Judge through Ogiri
rockname
0
160
新卒PdEのリアル
ryu1013
1
510
FreeBSDでZabbixを動かす
kenkino
0
320
LoopHub - ローカルで動く GitHub で、AI と共同開発
jugyo
1
560
AI活用は、個人から組織へ|マルチプレイヤーエージェントハーネス「QM」の社内活用事例 / AI use is moving from individuals to orgs
rkaga
1
150
アクセシビリティから考える情報設計
high_g_engineer
0
380
Omarchy Tokyo やると聞いて UMPC 買ってセットアップしてきた
mtsmfm
0
160
Featured
See All Featured
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.6k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
3k
Thoughts on Productivity
jonyablonski
76
5.4k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
203
76k
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
850
Building the Perfect Custom Keyboard
takai
2
880
Faster Mobile Websites
deanohume
310
32k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
530
Test your architecture with Archunit
thirion
2
2.4k
Everyday Curiosity
cassininazir
0
320
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.9k
The Pragmatic Product Professional
lauravandoore
37
7.4k
Transcript
Block is everywhere Event: LegalForce Ruby Meet Up #1 Date:
2019-12-11 Speaker: େխ࢙
pp self • ໊લɿେխ࢙ • ॴଐɿϑϦʔϥϯε • ΤσΟλɿVim • Α͍͘ΔίϛϡχςΟɿGrow.rbʢओ࠵ʣɺTama.rbͳͲ
RubyͷϒϩοΫૉΒ͍͠
RubyͷϒϩοΫͷΘΕํ
RubyͷϒϩοΫ͕ΘΕ͍ͯΔՕॴ • RailsͷϨΠΞτͷϨϯμϦϯάʢyieldʣ • ֤छgemͷઃఆʢconfigure doʣ • RakeFactoryBotʹද͞ΕΔDSL • Ϧιʔεͷཧ
• ϑοΫͷఆٛ • etc…
RailsͷϨΠΞτͷϨϯμϦϯά • ϨΠΞτϑΝΠϧͷதʹ͋Δ”yield”࣮ϒϩοΫΛධՁ͠ ͍ͯΔ • RailsͷϏϡʔʢςϯϓϨʔτʣ࠷ऴతʹRubyͱ࣮ͯ͠ߦ͞ ΕΔͷͰೖΕࢠΛ࣮ݱ͢ΔͷʹϒϩοΫΛωετ͍ͤͯ͞Δͱ ࢥΘΕΔ • Ұ൪ແҙࣝʹϒϩοΫΛ͍ͬͯΔՕॴͰʁ
֤छgemͷઃఆ • “configure do |config|”ͱ͔ͷΞϨવϒϩοΫΛ͍ͬͯΔ • ίϯϑΟάΦϒδΣΫτʹΞΫηε͢Δͷ͕ײతʹͰ͖Δ • ઃఆ͞ΕΔଆ”config =
Config.new; yield(config)”Έ͍ͨʹ ॻ͚Δ • ࣮ϒϩοΫΛ͏ඞཁͳ͍…ʁ
DSL • DSLΛ࣮͢ΔͷʹϒϩοΫʢͱ͍͏ΑΓProcΦϒδΣΫτ ͱ”instance_eval”ϝιουʣඞਢ • RSpecͩͱϒϩοΫΛ࣮ߦ͢Δͨͼʹಗ໊ΫϥεΛ࡞͍ͯͨ͠ Γ͢Δ • ʮϝλϓϩάϥϛϯάRubyʯͱ͍͏໊ஶΛಡΉͱΈ͕Θ͔Δ
Ϧιʔεͷཧ • “File.open do |f|”͕දత • “Net::HTTP.start do |http|”ͳΜ͔ͦ͏ •
ϝιου͕ϦιʔεΛ࡞͠ɺϒϩοΫ͕ด͡ΔͱϦιʔε ด͡ΒΕΔ
ϑοΫͷఆٛ • RSpecͷ”before(:each)”Railsͷ”before_action”ͳͲ͕දత • ϒϩοΫͷதΛProcΦϒδΣΫτͱͯ࣋ͪ͠ճ͢ • aroundܥͷϑοΫ෦ͰyieldΛݺͿͱຊॲཧ͕ΔͷͰೋ ॏʹϒϩοΫΛ͍ͬͯΔ
ଞʹ৭ʑͳϝιου͕ϒϩοΫΛड͚Δ • Enumerable#countʢϒϩοΫ͕trueͷཁૉΛ͑Δʣ • ActiveRecord::Relation#buildʢϒϩοΫͰΠϯελϯεઃఆʣ • Hash.newʢॳظԽͷํ๏Λنఆʣ • String#gsubʢஔͷํ๏Λنఆʣ
͓·͚
RubyͷϒϩοΫΫϩʔδϟ
पғͷڥʹΞΫηεͰ͖ΔͷͰɺ ৭ʑͱϋοΫ͢Δ͜ͱ͕Ͱ͖Δ
ྫɿΧϯλΦϒδΣΫτ