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
80
0
Share
Ruby Basics
Slides from the first day of the ruby@uniovi workshop
Diego Guerra Suárez
March 04, 2015
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
91
Curando el bacilo enmiequipus funcionabilis
dgsuarez
1
180
Ruby on the Web
dgsuarez
0
69
Other Decks in Programming
See All in Programming
Skillは並べた。動かなかった。契約で繋いだ。— 65個のSkillから、自走する開発サイクルへ
junholee
0
660
次世代リンターで探る、tsgo 時代における型認識カスタムルールの現実解
ytakahashii
1
600
自動レビューエンジンの実装と運用 ~レビューのない世界へ~
kurukuru1999
1
120
Structured Concurrency, Scoped Values and Joiners in the JDK 25 26 27
josepaumard
1
160
Agentic UI in the Frontend: Architectures with Open Standards @JAX 2026 in Mainz
manfredsteyer
PRO
0
120
20260514_its_the_context_window_stupid.pdf
heita
0
1.1k
PHPでローカル環境用のSSL/TLS証明書を発行することはできるのか? #phpconkagawa
akase244
0
370
SkillsをS3 Filesに置く時のあれこれ
watany
3
1.7k
When benchmarks go bad - what I learned from measuring performance wrong
hollycummins
0
400
継続的な負荷検証を目指して
pyama86
3
1.2k
今さら聞けないCancellationToken
htkym
0
130
20260514 - build with ai 2026 - build LINE Bot with Gemini CLI
line_developers_tw
PRO
0
460
Featured
See All Featured
Accessibility Awareness
sabderemane
1
120
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
150
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
410
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
430
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9k
Designing Experiences People Love
moore
143
24k
What's in a price? How to price your products and services
michaelherold
247
13k
RailsConf 2023
tenderlove
30
1.4k
Code Reviewing Like a Champion
maltzj
528
40k
Test your architecture with Archunit
thirion
1
2.2k
Odyssey Design
rkendrick25
PRO
2
620
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
280
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.