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
ruby-flip-flop
Search
maimu
June 26, 2024
Programming
160
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
100
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
710
before_rails_girls_after_rails_girls
maimux2x
0
870
my_study_of_ruby_method
maimux2x
1
210
one_liner_fizzbuzz
maimux2x
0
180
about_rails_girls_document_translation
maimux2x
0
6.4k
best_for_fbc
maimux2x
0
85
homemade_service_release_front_and_back
maimux2x
0
500
Other Decks in Programming
See All in Programming
改善しないと、タスクが回らない。 “てんこ盛りポジション” を引き継いだ情シスの、入社3ヶ月の業務改善録
krm963
0
270
楽しそうなつよつよエンジニアと目が死んでる僕/A brilliant engineer having a blast, and dead-eyed me.
3l4l5
2
190
AI Readyの正体はデータマネジメントだ メダリオン2.0の最前線
freee
PRO
0
270
AWS DevOps AgentのAzure接続機能を検証して見えた活用法/Use Cases Verified for the AWS DevOps Agent's Azure Connectivity Feature
masakiokuda
1
240
AIが無かった頃の素敵な出会いの話
codmoninc
1
440
170k Jobs a Day on GKE: Scaling Mercari's CI Platform - and What's Next for AI-Native Development
junyaokabe
0
110
AWS CDK を「作」ってみた 〜フルスクラッチで見えた CDK の裏側〜 / aws-cdk-from-scratch
gotok365
3
2.8k
torikago - Ruby::Boxで照らすモジュラモノリスの実行境界
se4weed
1
380
実装をデザインガイドラインに追従させるための取り組み / 260731-dip-mosh-design-system
dachi023
0
490
OpenSpecのproposalにbrainstormingを持たせてみた
tigertora7571
1
240
freeeにおけるEvalsの実践例の紹介
freee
PRO
0
120
PHP に部分適用が来るぞ!……ところで何それ?おいしいの? #phpcon / phpcon-2026
shogogg
0
670
Featured
See All Featured
First, design no harm
axbom
PRO
2
1.2k
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
4.2k
Darren the Foodie - Storyboard
khoart
PRO
3
3.6k
My Coaching Mixtape
mlcsv
0
230
Unsuck your backbone
ammeep
672
58k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3k
Balancing Empowerment & Direction
lara
6
1.2k
Large-scale JavaScript Application Architecture
addyosmani
515
110k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.2k
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
290
Statistics for Hackers
jakevdp
799
230k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.5k
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