print "elephant" if "elephant".include? "ant"
"elephant"
Slide 12
Slide 12 text
print "elephant" if "elephant".include? "ant"
You can speak this in proper english:
“Print an elephant if elephant include ant”
Slide 13
Slide 13 text
print "elephant" if "elephant".include? "ant"
You can speak this in proper english:
“Print elephant if elephant include ant”
Slide 14
Slide 14 text
print "elephant" if "elephant".include? "ant"
You can speak this in proper english:
“Print elephant if elephant include ant”
Slide 15
Slide 15 text
This sentence still doesn’t make any sense,
but it is readable
You can speak this in proper english:
“Print elephant if elephant include ant”
print "elephant" if "elephant".include? "ant"
Slide 16
Slide 16 text
print "elephant" if "elephant".include? "ant"
“if” can be used to modify expression
Slide 17
Slide 17 text
print "elephant" if "elephant".include? "ant"
“if” can be used to modify expression
Method name can have question mark
Slide 18
Slide 18 text
Writing Ruby code is easy
because it can be written in
plain english
Slide 19
Slide 19 text
Programmer can express
themselves into their code
Slide 20
Slide 20 text
movie.awesome?
bedroom.with_twin_beds?
recipe.cooked_under 10.minutes
Programmer can express
themselves into their code
Slide 21
Slide 21 text
humans.obliterate!
Slide 22
Slide 22 text
humans.obliterate! unless humans.nice?
Slide 23
Slide 23 text
There are more than one way
to do anything in Ruby
Slide 24
Slide 24 text
false
2.negative?
2 < 0
Slide 25
Slide 25 text
"hello"
puts "hello"
$stdout.puts "hello"
p "hello"
Slide 26
Slide 26 text
one = 1
two = 2
three = 3
one, two, three = [1, 2, 3]
Slide 27
Slide 27 text
one = 1
two = 2
three = 3
one, two, three = [1, 2, 3]
one, two, three = 1, 2, 3
You don’t even need
Slide 28
Slide 28 text
[1, 2, 3, 4, 5].map { |element|
element if element.even?
}.compact
[2,4]
%w(Google Yahoo MSN).map do |engine|
"https://www.#{engine.downcase}.com"
end
["https://www.google.com",
"https://www.yahoo.com",
"https://www.msn.com"]
Slide 34
Slide 34 text
Blocks allows us to attach closure to
any method
%w(Google Yahoo MSN).map do |engine|
"https://www.#{engine.downcase}.com"
end
this will be returned
Slide 35
Slide 35 text
Blocks allows us to attach closure to
any method
%w(Google Yahoo MSN).map do |engine|
"https://www.#{engine.downcase}.com"
end
this will be returned
You don’t even need to write return
Slide 36
Slide 36 text
Almost forgot!
%w(Google Yahoo MSN).map do |engine|
"https://www.#{engine.downcase}.com"
end
Is equal: ["Google", "Yahoo", "MSN"]
Slide 37
Slide 37 text
More Blocks
Slide 38
Slide 38 text
%w(jakarta bandung).map do |city|
city.capitalize
end
Slide 39
Slide 39 text
%w(jakarta bandung).map do |city|
city.capitalize
end
["Jakarta", "Bandung"]
[
["jakarta", "province"],
["bandung", "city"]
].each do |name, type|
puts "#{name}_#{type}"
end
Slide 42
Slide 42 text
"jakarta_province"
"bandung_city"
[
["jakarta", "province"],
["bandung", "city"]
].each do |name, type|
puts "#{name}_#{type}"
end
Slide 43
Slide 43 text
This kind of flexibility
improves the joy of
programming
Slide 44
Slide 44 text
You might notice that Ruby
makes you write fewer
codes
Slide 45
Slide 45 text
one = 1
two = 2
three = 3
one, two, three = [1, 2, 3]
one, two, three = 1, 2, 3
You don’t even need
FLASHBACK!
Slide 46
Slide 46 text
[1, 2, 3, 4, 5].select(&:even?)
[2,4]
FLASHBACK!
Slide 47
Slide 47 text
Who doesn’t want to write
less?
Slide 48
Slide 48 text
Have you tried
programming with Ruby?
Slide 49
Slide 49 text
You might not noticed, but Mac users
already have Ruby
(even though its outdated)
Installation is pretty easy:
https://www.ruby-lang.org/en/docum
entation/installation/
Slide 50
Slide 50 text
It only takes 20 minutes to learn
Ruby from this page:
https://www.ruby-lang.org/en/docu
mentation/quickstart/
Slide 51
Slide 51 text
There is also tutorials in Bahasa
Indonesia:
https://www.idrails.com/
Slide 52
Slide 52 text
How about you try to learn
together with fellow
Rubyists?
Slide 53
Slide 53 text
Ruby community is
known to be friendly
(nice)
Slide 54
Slide 54 text
MINASWAN
(Matz is nice and so we are nice)
みなさん (read: mina-san)
translation: everyone (polite)
Slide 55
Slide 55 text
MINASWAN
(Matz is nice and so we are nice)
みなさん (read: mina-san)
translation: everyone (polite)
Slide 56
Slide 56 text
Friday Hug
Slide 57
Slide 57 text
No content
Slide 58
Slide 58 text
No content
Slide 59
Slide 59 text
In Indonesia, we are known as
ID-Ruby
We are active on Slack and Telegram
Slide 60
Slide 60 text
In Indonesia, we are known as
ID-Ruby
We are active on Slack and Telegram
Feel free to join: http://ruby.id/slack
and https://t.me/ruby_id
Slide 61
Slide 61 text
We held meetups regularly
Slide 62
Slide 62 text
We held meetups regularly
Slide 63
Slide 63 text
Ruby ecosystem is huge
Slide 64
Slide 64 text
More than 135,000 gems in
rubygems.org
Slide 65
Slide 65 text
“Gems” are what we called
as Ruby libraries
Slide 66
Slide 66 text
One of the most popular gem is
Ruby on Rails framework
Slide 67
Slide 67 text
It is said that Rails made Ruby
gaining popularity in 2006
Slide 68
Slide 68 text
Its over 10 years, but Rails is still on
demand!
https://infinum.co/the-capsized-eight/analyzing-rubygems-stats-v2016
Slide 69
Slide 69 text
Big companies that uses Ruby
Slide 70
Slide 70 text
● Github
● Heroku
● Airbnb
● Shopify
Slide 71
Slide 71 text
How about in
Indonesia?
Slide 72
Slide 72 text
● Bukalapak
● Go-Jek
● Midtrans
● Vidio
Slide 73
Slide 73 text
Now you know!
Slide 74
Slide 74 text
List of Ruby companies in
Indonesia can be seen in
ID-Ruby homepage!
Slide 75
Slide 75 text
No content
Slide 76
Slide 76 text
Feel free to browse http://ruby.id !
Slide 77
Slide 77 text
How about?
Slide 78
Slide 78 text
Started using Rails on ver
1.2.3 with Ruby 1.8.7
Slide 79
Slide 79 text
Current Rails version is 5.1 with
Ruby 2.4
Started using Rails on ver
1.2.3 with Ruby 1.8.7 (2009!)
Slide 80
Slide 80 text
Previously we used ColdFusion
Slide 81
Slide 81 text
We have several large Rails
applications running in Cookpad!
Slide 82
Slide 82 text
Our app servers run less than
100ms
Slide 83
Slide 83 text
If you are interested
https://speakerdeck.com/mirakui/high-performance-rails-long-edition
Slide 84
Slide 84 text
If you are interested
https://speakerdeck.com/a_matsuda/the-recip
e-for-the-worlds-largest-rails-monolith
Slide 85
Slide 85 text
You can still be productive and
run fast web application with
Ruby on Rails