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
79
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
88
Curando el bacilo enmiequipus funcionabilis
dgsuarez
1
170
Ruby on the Web
dgsuarez
0
67
Other Decks in Programming
See All in Programming
半自動E2Eで手っ取り早くリグレッションテストを効率化しよう
beryu
6
1.5k
MCPでVibe Working。そして、結局はContext Eng(略)/ Working with Vibe on MCP And Context Eng
rkaga
5
2.4k
Чего вы не знали о строках в Python – Василий Рябов, PythoNN
sobolevn
0
110
デザイナーが Androidエンジニアに 挑戦してみた
874wokiite
0
640
Introducing FrankenPHP gRPC
dunglas
2
780
複雑なフォームに立ち向かう Next.js の技術選定
macchiitaka
3
950
Performance for Conversion! 分散トレーシングでボトルネックを 特定せよ
inetand
0
5.6k
個人開発で徳島大学生60%以上の心を掴んだアプリ、そして手放した話
akidon0000
1
190
アプリの "かわいい" を支えるアニメーションツールRiveについて
uetyo
0
300
プログラミングどうやる? ~テスト駆動開発から学ぶ達人の型~
a_okui
0
170
スケールする組織の実現に向けた インナーソース育成術 - ISGT2025
teamlab
PRO
3
190
まだ世にないサービスをAIと創る話 〜 失敗から学ぶフルスタック開発への挑戦 〜
katayamatg
0
100
Featured
See All Featured
jQuery: Nuts, Bolts and Bling
dougneiner
64
7.9k
BBQ
matthewcrist
89
9.8k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.2k
We Have a Design System, Now What?
morganepeng
53
7.8k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
Learning to Love Humans: Emotional Interface Design
aarron
274
40k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
15
1.7k
Mobile First: as difficult as doing things right
swwweet
224
9.9k
The Cost Of JavaScript in 2023
addyosmani
53
8.9k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
18
1.1k
Product Roadmaps are Hard
iamctodd
PRO
54
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.