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
170
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
型も通る、synthも通る、それでも危ない 〜AIのCDKの権限とコストを機械で検証する〜 / It Passes Type Checks, It Passes Synth Checks, but It’s Still Risky — Automatically Verifying Permissions and Costs in AI’s CDK —
seike460
PRO
1
510
What's New in Android 2026
veronikapj
0
240
琵琶湖の水は止められてもNet--HTTPのリトライは止められない / You might be able to stop the water flow of Lake Biwa but you can't stop Net::HTTP retries
luccafort
PRO
0
520
改善しないと、タスクが回らない。 “てんこ盛りポジション” を引き継いだ情シスの、入社3ヶ月の業務改善録
krm963
0
240
ドリフトを絶対に許さない(?)CDK運用 / CDK Ops with Zero Tolerance for Drifts (?)
akihisaikeda
1
150
TSX の <Hoge<Fuga>> という構文に驚いた話 / tsx-type-argument-syntax
kanaru0928
0
200
属人化した知識を、 AIが辿れる地図にする
pkshadeck
PRO
1
130
生成AI導入の「期待外れ」を乗り越える ー 開発フロー改革が目指す、真の組織変革
starfish719
0
3.5k
ルールを書いて終わらせないハーネスエンジニアリング
yug1224
4
1.8k
【やさしく解説 設計編・中級 #6】良いアーキテクチャとは ~ 一本の登り道の、行き先 ~
panda728
PRO
0
200
「寝てても仕事が進む」Claude Codeで組む第二の脳
tomoyafujita2016
0
260
壊れたパーサから始める関数型設計と構成的なパーサ #fp_matsuri
raiga0310
2
430
Featured
See All Featured
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
410
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
200
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.3k
How Software Deployment tools have changed in the past 20 years
geshan
1
34k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
4.1k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
270
Crafting Experiences
bethany
1
240
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
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