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
1
520
ちょっとしたRubyの話
t0yohei
November 11, 2018
Tweet
Share
More Decks by t0yohei
See All by t0yohei
Vue の Input における State は親で持つべきか子で持つべきか
t0yohei
0
70
Vue.js を使って Grid System を実装した話
t0yohei
2
7.5k
負債が溜まったレガシーフロントエンド画面を Vue.js でリプレイスした話
t0yohei
0
2.2k
プログラミング入門に失敗した話
t0yohei
0
200
【ITエンジニアが怪我で労災!?】 仕事中に足の小指が骨折したら起きること
t0yohei
0
440
Protocol Buffers で Web APIのスキーマ駆動開発がしたい
t0yohei
0
220
Ruby と JavaScript の違い( Function 編)
t0yohei
1
340
副業のノウハウ
t0yohei
0
200
自作キーボード入門してみた
t0yohei
0
170
Other Decks in Technology
See All in Technology
Webアクセシビリティ技術と実装の実際
tomokusaba
0
210
大規模サービスにおける レガシーコードからReactへの移行
magicpod
1
130
Agentic Software Modernization - Back to the Roots (Zürich Agentic Coding and Architectures, März 2026)
feststelltaste
1
170
メタデータ同期に潜んでいた問題 〜 Cache Stampede 時の Cycle Wait を⾒つけた話
lycorptech_jp
PRO
0
150
越境する組織づくり ─ 多様性を前提にしたチームビルディングとリードの実践知
kido_engineer
1
110
Introduction to Sansan, inc / Sansan Global Development Center, Inc.
sansan33
PRO
0
3k
生成AIの利用とセキュリティ /gen-ai-and-security
mizutani
1
1.2k
Master Dataグループ紹介資料
sansan33
PRO
1
4.4k
Exadata Database Service on Dedicated Infrastructure(ExaDB-D) UI スクリーン・キャプチャ集
oracle4engineer
PRO
7
7.1k
GitLab Duo Agent Platform + Local LLMサービングで幸せになりたい
jyoshise
0
110
生成AI活用によるPRレビュー改善の歩み
lycorptech_jp
PRO
5
2k
ブラックボックス観測に基づくAI支援のプロトコルのリバースエンジニアリングと再現~AIを用いたリバースエンジニアリング~ @ SECCON 14 電脳会議 / Reverse Engineering and Reproduction of an AI-Assisted Protocol Based on Black-Box Observation @ SECCON 14 DENNO-KAIGI
chibiegg
0
140
Featured
See All Featured
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
1
140
Design in an AI World
tapps
0
160
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
660
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
65
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
760
Statistics for Hackers
jakevdp
799
230k
Utilizing Notion as your number one productivity tool
mfonobong
4
240
First, design no harm
axbom
PRO
2
1.1k
My Coaching Mixtape
mlcsv
0
64
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
Fireside Chat
paigeccino
42
3.8k
So, you think you're a good person
axbom
PRO
2
1.9k
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楽しいよ!