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の話
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
t0yohei
November 11, 2018
Technology
520
1
Share
ちょっとしたRubyの話
t0yohei
November 11, 2018
More Decks by t0yohei
See All by t0yohei
Vue の Input における State は親で持つべきか子で持つべきか
t0yohei
0
80
Vue.js を使って Grid System を実装した話
t0yohei
2
7.7k
負債が溜まったレガシーフロントエンド画面を Vue.js でリプレイスした話
t0yohei
0
2.2k
プログラミング入門に失敗した話
t0yohei
0
220
【ITエンジニアが怪我で労災!?】 仕事中に足の小指が骨折したら起きること
t0yohei
0
450
Protocol Buffers で Web APIのスキーマ駆動開発がしたい
t0yohei
0
220
Ruby と JavaScript の違い( Function 編)
t0yohei
1
350
副業のノウハウ
t0yohei
0
210
自作キーボード入門してみた
t0yohei
0
180
Other Decks in Technology
See All in Technology
GitHub Copilot CLI と VS Code Agent Mode の使い分け
tomokusaba
0
140
Google Cloud Next '26 の裏でこっそりリリースされたCloud Number Registry & Cloud Hub コスト分析 を試してみた
hikaru1001
0
150
需要創出(Chatwork)×供給(BPaaS) フライホイールとMoat 実行能力の最適配置とAI戦略
kubell_hr
0
1.9k
国内外の生成AIセキュリティの最新動向 & AIガードレール製品「chakoshi」のご紹介 / Latest Trends in Generative AI Security (Domestic & International) & Introduction to AI Guardrail Product "chakoshi"
nttcom
4
1.7k
COBOL婆さんの伝説
poropinai1966
0
130
AI時代の品質はテストプロセスの作り直し #scrumniigata
kyonmm
PRO
4
1.2k
AIはハッカーを減らすのか、増やすのか?──現役ホワイトハッカーから見るAI時代のリアル【MEGU-Meet】
cscengineer
PRO
0
270
「SaaSの次の時代」に重要性を増すステークホルダーマネジメントの要諦 ~解像度を圧倒的に高めPdMの価値を最大化させる方法~
kakehashi
PRO
3
3.6k
サービスの信頼性を高めるため、形骸化した「プロダクションミーティング」を立て直すまでの取り組み
stefafafan
1
220
小説執筆のハーネスエンジニアリング
yoshitetsu
0
910
もっとコンテンツをよく構造化して理解したいので、LLM 時代こそ Taxonomy の設計品質に目を向けたい〜!
morinota
0
160
ハーネスエンジニアリング入門
knishioka
0
110
Featured
See All Featured
Thoughts on Productivity
jonyablonski
76
5.1k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
680
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
1
530
Test your architecture with Archunit
thirion
1
2.2k
How GitHub (no longer) Works
holman
316
150k
Balancing Empowerment & Direction
lara
6
1.1k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Mind Mapping
helmedeiros
PRO
1
180
From π to Pie charts
rasagy
0
180
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.4k
Product Roadmaps are Hard
iamctodd
PRO
55
12k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Transcript
ちょっとしたRubyの話 2018/11/11 @t0yohei
Rubyにそこまで詳しくない人 or Ruby初めてまもない人向けです
Rubyとは • 1993年にMatzが開発 • OSS言語 • Ruby on Railsとは切っても切れない縁 •
Rubyの実装はC言語でされている • そのため、MatzはRubyエンジニアではなくCエンジニア
私がRuby好きな理由 • Rubyと同い年で謎の親近感(1993年生まれ) • プログラミングを好きにしてくれた言語 • スラスラ書ける • 開発者コミュニティーが心地よい
Rubyの言語的特徴 • オブジェクト指向言語 • 動的型付けスクリプト言語 • etc...
Rubyの面白い所
(ほぼ)全てがオブジェクト • Class → Classクラスのオブジェクト • method → Objectクラスのオブジェクト
Class クラス
Method クラス
動的型付けの特性を生かしたダックタイピング • 引数に渡したobjectが、そのメソッドを持っていたら実行できる • ex) def count_object(object) p object.count end
object = [1, 2, 3] count_object(object) #結果 => 3 object = “123” count_object(object) #結果 => 3 object = { 1 => “1”, 2 => 2 , 3 => “3” } count_object(object) #結果 => 3 String Array Hash count_objectというメソッドを定義 引数は一つ(型はなんでもいい)
動的型付けの特性を生かしたダックタイピング 変数名: string、型: String 変数名: array、型: Array メソッド名: one_count、引数: 可変長引数
変数名: object、型: countメソッドを持っている何か 実行されて結果が帰ってくる
好きなメソッド (Array#inject) 配列の合計値の計算 injectを使わない場合
好きなメソッド (Array#inject) 配列の合計値の計算 injectを使った場合
小話 Q. 次の配列arrayAから配列arrayBの要素を取り除くには?? arrayA = [1, 2, 3] arrayB =
[1, 2] 変数名: arrayA、型: Array 変数名: arrayB、型: Array
小話 Q. 次の配列arrayAから配列arrayBの要素を取り除くには?? arrayA = [1, 2, 3] arrayB =
[1, 2] → 配列arrayAから配列arrayBから、型: Array、要素: 1 の配列を作りたい ex) arrayC = [1] https://twitter.com/bendhalpern/status/1060965181759635456 変数名: arrayA、型: Array 変数名: arrayB、型: Array
Ruby楽しいよ!