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の話
Search
t0yohei
November 11, 2018
Technology
540
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
ちょっとしたRubyの話
t0yohei
November 11, 2018
More Decks by t0yohei
See All by t0yohei
社内AIエージェント「Askワンバン」における コストチューニングの取り組み
t0yohei
0
110
Vue の Input における State は親で持つべきか子で持つべきか
t0yohei
0
110
Vue.js を使って Grid System を実装した話
t0yohei
2
8k
負債が溜まったレガシーフロントエンド画面を Vue.js でリプレイスした話
t0yohei
0
2.3k
プログラミング入門に失敗した話
t0yohei
0
250
【ITエンジニアが怪我で労災!?】 仕事中に足の小指が骨折したら起きること
t0yohei
0
470
Protocol Buffers で Web APIのスキーマ駆動開発がしたい
t0yohei
0
240
Ruby と JavaScript の違い( Function 編)
t0yohei
1
370
副業のノウハウ
t0yohei
0
220
Other Decks in Technology
See All in Technology
Draft AIエージェントの トークン消費を最小化する 8つの原則
kinopeee
6
1.8k
演劇と私とスクラム
chinmo
0
170
cdk deployとcdkd deploy、実際にデプロイして5倍速近くの差を実測した
yama3133
1
120
AIで選択肢が広がった組織設計の理想と現実
konifar
15
6.8k
クラウドエージェントの先駆け Devin。今も最先端を走る、他との違い
kinopeee
1
500
"AWSはちょっと苦手"でも大丈夫。AWS Blocks で手軽に作る Flutter のバックエンド #FlutterKaigi
tacck
PRO
0
100
DevelopersIO2026 -バックアップは“消されないこと”が9割-
yoshida0129
0
440
視野はAIに、視座は人に / ai-for-breadth-humans-for-perspective
nkzn
3
1.6k
素人でもできた!AIを使った短編小説創作入門
delhi09
PRO
0
200
200人の配信コメント、 全部Jevが仕分けます 〜 マサカリガードを作ってみた 〜
katayamatg
1
430
Filter What the LLM Reads: RAG Governance with AgentCore Gateway
yakumo
1
130
How we choose session proposals
kawaguti
PRO
1
190
Featured
See All Featured
Building a Scalable Design System with Sketch
lauravandoore
464
34k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.8k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
590
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
2
960
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
290
The Limits of Empathy - UXLibs8
cassininazir
2
740
Ruling the World: When Life Gets Gamed
codingconduct
0
420
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
The Cost Of JavaScript in 2023
addyosmani
55
10k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
2
6.4k
Optimising Largest Contentful Paint
csswizardry
37
4k
Building Flexible Design Systems
yeseniaperezcruz
330
41k
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楽しいよ!