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 Basics
Search
Diego Guerra Suárez
March 04, 2015
Programming
0
77
Ruby Basics
Slides from the first day of the ruby@uniovi workshop
Diego Guerra Suárez
March 04, 2015
Tweet
Share
More Decks by Diego Guerra Suárez
See All by Diego Guerra Suárez
Reruby: Automated refactoring with Ruby
dgsuarez
0
170
Programas que se entienden a sí mismos
dgsuarez
0
87
Curando el bacilo enmiequipus funcionabilis
dgsuarez
1
170
Ruby on the Web
dgsuarez
0
66
Other Decks in Programming
See All in Programming
PipeCDのプラグイン化で目指すところ
warashi
1
290
MDN Web Docs に日本語翻訳でコントリビュートしたくなる
ohmori_yusuke
1
130
リバースエンジニアリング新時代へ! GhidraとClaude DesktopをMCPで繋ぐ/findy202507
tkmru
2
340
AIともっと楽するE2Eテスト
myohei
8
2.9k
TypeScriptでDXを上げろ! Hono編
yusukebe
3
710
技術同人誌をMCP Serverにしてみた
74th
1
680
Rubyでやりたい駆動開発 / Ruby driven development
chobishiba
1
760
The Niche of CDK Grant オブジェクトって何者?/the-niche-of-cdk-what-isgrant-object
hassaku63
1
570
テストから始めるAgentic Coding 〜Claude Codeと共に行うTDD〜 / Agentic Coding starts with testing
rkaga
15
5.4k
코딩 에이전트 체크리스트: Claude Code ver.
nacyot
0
900
ニーリーにおけるプロダクトエンジニア
nealle
0
910
NPOでのDevinの活用
codeforeveryone
0
880
Featured
See All Featured
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
7
750
Build your cross-platform service in a week with App Engine
jlugia
231
18k
Measuring & Analyzing Core Web Vitals
bluesmoon
7
510
Thoughts on Productivity
jonyablonski
69
4.7k
Documentation Writing (for coders)
carmenintech
72
4.9k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
Designing Experiences People Love
moore
142
24k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.4k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
282
13k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
GraphQLの誤解/rethinking-graphql
sonatard
71
11k
Transcript
Ruby Basics Ruby: from 0 to 100 in 14400 seconds
(1) ruby@uniovi: Introducing the Ruby programming language School of Computer Sciences University of Oviedo March 2015
Welcome aboard!
https://github.com/ruby-uniovi/rubyeii
git clone https://github.com/ruby-uniovi/rubyeii.git cd rubyeii vagrant up vagrant reload
None
Ruby
まつもとゆきひろ Yukihiro ‘Matz’ Matsumoto
But… why Ruby?
Fun
Principle of least astonishment
Poetry mode
Expressive > 3.times { print "Ho" } #=>"HoHoHo" > 151.even?
#=> false
Agile
Community
Matz is Nice And So We Are Nice a.k.a. MINASWAN
Basics
None
> 2.next #=> 3 (Fixnum)
class Dog def woof puts"Wooof woooof!" end end
> Dog.class #=> Class > Dog.method(:woof).class #=> Method
Modules
module Animals class Dog # … implementation … end end
module Playable def play # … implementation … end end
class Song include Playable end
Methods
def factorial(n) return 1 if n == 0 n *
factorial(n -1) end ❏ Ruby methods always return the result of their last evaluated expression. ❏ return is only used to break out of the method before its end.
Inheritance
module Animals class Dog < Animal # … implementation …
end end ❏ A class can only inherit from ONE other class ❏ There aren’t Abstract classes in Ruby (in contrast to Java)
Misc
def say_hello(name) puts "Hello #{name}!" end def say_hello name puts("Hello
#{name}!"); end ❏ In Ruby, parenthesis and semicolons are optional ❏ Both methods have valid syntax and are equivalent.
VAT = 0.04 total = begin sum = products.map(&:price).inject(&:+) sum
+= (sum * VAT) end In Ruby, you can assign the result of any expression as a variable value.