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
ruby-flip-flop
Search
maimu
June 26, 2024
Programming
170
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
ruby-flip-flop
maimu
June 26, 2024
More Decks by maimu
See All by maimu
Gentoo 1年生 ビルドは終わらない
maimux2x
0
110
Rails 1.0 のコードで学ぶ find_by* と method_missing の仕組み / Learn how find_by_* and method_missing work in Rails 1.0 code
maimux2x
1
1.5k
rails_girls_is_my_gate_to_join_the_ruby_commuinty
maimux2x
0
730
before_rails_girls_after_rails_girls
maimux2x
0
900
my_study_of_ruby_method
maimux2x
1
220
one_liner_fizzbuzz
maimux2x
0
180
about_rails_girls_document_translation
maimux2x
0
6.4k
best_for_fbc
maimux2x
0
88
homemade_service_release_front_and_back
maimux2x
0
520
Other Decks in Programming
See All in Programming
残高管理から台帳サービスへの進化
artoy
1
210
Workers Cache を知る
syumai
0
370
Zero-Tap Sign-In対応、結局何をすればいいの?
mitohato14
0
190
【加筆修正版】Laravel のアプリケーションをどこにデプロイするか #phpcon_ehime
akase244
0
160
Event is what happens
moro
2
1.2k
Domain-Driven Transformation
hschwentner
2
2.3k
Performance Optimization With LLMs
xleitix
0
180
Optunaを作ったときにやりたかったこと、その後 (2026/10/16, Optuna Meetup #3)
iwiwi
2
1.2k
Web Framework Benchmark Battle 2026, Any%
a_matsuda
2
2.7k
Next.js: The final boss of Web Performance
guaca
0
310
No More NoSuchMethodError
exoego
1
110
GraphQL の onError と Nullability のこれから
quramy
0
140
Featured
See All Featured
Building Flexible Design Systems
yeseniaperezcruz
330
41k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.8k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
760
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
550
What the history of the web can teach us about the future of AI
inesmontani
PRO
2
750
ラッコキーワード サービス紹介資料
rakko
3
5.4M
How STYLIGHT went responsive
nonsquared
100
6.3k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2.2k
What does AI have to do with Human Rights?
axbom
PRO
1
2.5k
Code Reviewing Like a Champion
maltzj
529
40k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.4k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.6k
Transcript
Rubyのflip-flop と 仲良くなりたい 2024-06-26 maimu
自己紹介 名前:maimu(@maimux2x) 所属:永和システムマネジメント • フィヨルドブートキャンプ卒業生 • Rails Girls Tokyo 16th
オーガナイザー • 好きなRailsのメソッドはindex_by よろしくお願いします!
Rubyのflip-flopと仲良くなりたい
flip-flopとの出会い
ruby-jpで質問 ぺんさんが考え方を教えてくれた
「..」と「...」の違いが分からない
先ほどの実行例で確認してみる
るりまを見てみる https://docs.ruby-lang.org/ja/latest/doc/spec=2foperator.html 「..」の場合: 1. 初期状態では式1だけを評価し、式1が真を返 すまでは false を返します。 2. 式1が真を返すと
true を返します。式2が真な ら初期状態に戻ります。 3. この後は式2だけを評価し、式2が真を返すま で true を返します。 4. 式2が真を返すと true を返したあと、初期状態 に戻ります。 「...」の場合: 1. 初期状態では式1だけを評価し、式1が真を返 すまでは false を返します。 2. 式1が真を返すと true を返します。 3. この後は式2だけを評価し、式2が真を返すま で true を返します。 4. 式2が真を返すと true を返したあと、初期状態 に戻ります。
るりまのサンプルコードを実行
「..」の場合
「...」の場合
「..」と「...」の違い • 条件式1と条件式2が同じ内容である場合に結果に違いが発生する • 「..」の場合は「条件式に該当する結果」だけが得られる • 「...」の場合は「条件式に該当した結果から次に該当する結果まで」が得られる ◦ 次に該当する結果がなければ条件式に該当後から最後まで
やってみる self-introduction.mdを作成
「..」の場合
「...」の場合
やってみる② sample.mdを作成 るりまのサンプルコードを利用
「..」の場合
「...」の場合
チョット仲良くなれた!
参考資料 • https://docs.ruby-lang.org/ja/latest/doc/spec=2foperator.html • https://qiita.com/Ping/items/acb7fbb9aa141c2c46df