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 Basics
Search
Diego Guerra Suárez
March 04, 2015
Programming
87
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Ruby Basics
Slides from the first day of the ruby@uniovi workshop
Diego Guerra Suárez
March 04, 2015
Transcript
31 slides
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.
More Decks by Diego Guerra Suárez
See All by Diego Guerra Suárez
Reruby: Automated refactoring with Ruby
dgsuarez
0
180
Programas que se entienden a sí mismos
dgsuarez
0
95
Curando el bacilo enmiequipus funcionabilis
dgsuarez
1
190
Ruby on the Web
dgsuarez
0
78
Other Decks in Programming
See All in Programming
protojson における文字化けの扱い
kazuki1023
0
440
Apple Intelligenceとオンデバイス時代の到来
yahir0
0
250
AIコーディング時代のKotest ユニットテストから APIレベルの仕様固定化テストへ
ooga04
0
260
どうしても Eloquent でリポジトリパターンをやりたいんだ #phpcon_niigata / phpcon-niigata-2026
shogogg
0
600
Claude Codeのおかげでやりたいことがやれるようになったんだよォー!
sms_tech
0
130
SFCで実現する病院・医療システムの動的組み立て式UI
koukimiura
1
180
AI Augmentation Techniques with Liberty
ivargrimstad
1
510
プロジェクトコードをキレイキレイしよう!暗黙的な参照を読み解く静的解析
ostk0069
0
220
疎結合とは何か?ソフトウェア設計における結合バランスについて考える #phpcon_niigata
kajitack
2
310
AI時代のFlutter品質設計 — アプリ品質を守るQuality Layers
omatty198
0
380
Rails初心者がパスキーを実装してみて大変だったこと
ktombow
0
210
Vue.jsで作る空間解析アプリとCapacitorプラグインのData Bridge
hal_spidernight
1
180
Featured
See All Featured
Large-scale JavaScript Application Architecture
addyosmani
516
110k
Mobile First: as difficult as doing things right
swwweet
225
10k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
2
3k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.9k
Navigating Weather and Climate Data
rabernat
0
590
A Modern Web Designer's Workflow
chriscoyier
699
190k
Believing is Seeing
oripsolob
1
280
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
2
530
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.4k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.3k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
300
Technical Leadership for Architectural Decision Making
baasie
4
650