Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
Ruby'i Tanıyalım
Uğur Özyılmazel
January 17, 2015
Programming
0
230
Ruby'i Tanıyalım
17 OCAK RUBY VE RUBY ON RAİLS İLE TANIŞMA ETKİNLİĞİ için yapmış olduğum Ruby tanıtım sunumu.
Uğur Özyılmazel
January 17, 2015
Tweet
Share
More Decks by Uğur Özyılmazel
See All by Uğur Özyılmazel
Makefile değil, Rakefile
vigo
1
450
Bir Django Projesi : <Buraya RUBY ekleyin>
vigo
1
300
Ruby 101
vigo
1
74
Django
vigo
4
350
Gündelik Hayatta GIT İpuçları
vigo
3
530
Bash 101
vigo
3
440
TDD - Test Driven Development
vigo
2
120
Vagrant 101
vigo
2
180
Yazılımcı Kimdir?
vigo
0
330
Other Decks in Programming
See All in Programming
社会人 20 年目エンジニア、発信で技術学びなおしてる話
e99h2121
1
140
ECS Service Connectでマイクロサービスを繋いでみた
xblood
0
740
CDKでValidationする本当の方法 / cdk-validation
gotok365
1
230
量子コンピュータ時代のプログラミングセミナー / 20221222_Amplify_seminar _route_optimization
fixstars
0
250
[2023년 1월 세미나] 데이터 분석가 되면 어떤 일을 하나요?
datarian
0
610
Listかもしれない
irof
1
280
Amazon QuickSightのアップデート -re:Invent 2022の復習&2022年ハイライト-
shogo452
0
240
An Advanced Introduction to R
nicetak
0
1.8k
Rust、何もわからない...#6発表資料
ryu19
0
140
Git Rebase
bkuhlmann
10
1.2k
Hasura の Relationship と権限管理
karszawa
0
180
Circuit⚡
monaapk
0
200
Featured
See All Featured
Dealing with People You Can't Stand - Big Design 2015
cassininazir
351
21k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
29
7.9k
It's Worth the Effort
3n
177
26k
5 minutes of I Can Smell Your CMS
philhawksworth
198
18k
Fireside Chat
paigeccino
16
1.9k
Designing on Purpose - Digital PM Summit 2013
jponch
108
5.9k
Rails Girls Zürich Keynote
gr2m
87
12k
Making the Leap to Tech Lead
cromwellryan
117
7.7k
We Have a Design System, Now What?
morganepeng
37
5.9k
Embracing the Ebb and Flow
colly
75
3.6k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
349
27k
4 Signs Your Business is Dying
shpigford
171
20k
Transcript
None
Uğur "vigo" Özyılmazel vigobronx vigo
webboxio http://webbox.io
PROGRAMLAMA DİLİ
None
Ruby, programcıları mutlu etmek üzere tasarlanmıştır! - Matz
None
TÜRKÇE BİLİYOR!
şehirler = %w[İstanbul Ankara Viyana Paris] gittiğim_şehirler = %w[İstanbul Viyana]
puts "Gitmem gereken şehirler", şehirler - gittiğim_şehirler Gitmem gereken şehirler Ankara Paris
Perl'den güçlü
python'dan daha object orıented
Herşey : nesne
5.class # => Fixnum 5.class.superclass # => Integer 5.class.superclass.superclass #
=> Numeric 5.class.superclass.superclass.superclass # => Object 5.class.superclass.superclass.superclass.superclass # => BasicObject
Fixnum Integer Numeric Object Basic Object
5.methods # => [:to_s, :inspect, :
[email protected]
, :+, :-, :*, :/,
:div, : %, :modulo, :divmod, :fdiv, :**, :abs, :magnitude, :==, :===, :<=>, : >, :>=, :<, :<=, :~, :&, :|, :^, : [], :<<, :>>, :to_f, :size, :bit_length, :zero?, :odd?, :even?, :succ , :integer?, :upto, :downto, :times, :next, :pred, :chr, :ord, :to_i, :to_int, :floor, :ceil, :truncate, :round, :gcd, :lcm, :gcdlcm, :nume rator, :denominator, :to_r, :rationalize, :singleton_method_added, :c oerce, :i, :
[email protected]
, :eql?, :remainder, :real?, :nonzero?, :step, :quo, :to_c, :real, :imaginary, :imag, :abs2, :arg, :angle, :phase, :rectangular, :rect, :polar, :conjugate, :conj, :between?, :nil?, :=~, :!~, :hash, :class, :singleton_class, :clone, :dup, :taint, :tainted?, :untaint, :untrust , :untrusted?, :trust, :freeze, :frozen?, :methods, :singleton_method s, :protected_methods, :private_methods, :public_methods, :instance_v ariables, :instance_variable_get, :instance_variable_set, :instance_v ariable_defined?, :remove_instance_variable, :instance_of?, :kind_of? , :is_a?, :tap, :send, :public_send, :respond_to?, :extend, :display, :method, :public_method, :singleton_method, :define_singleton_method, :object_id, :to_enum, :enum_for, :equal?, :!, :! =, :instance_eval, :instance_exec, :__send__, :__id__]
TÜM SINIFLAR AÇIKTIR!
class Fixnum def kere(n) self * n end end 5.kere(5)
# => 25 5.kere(5).kere(2) # => 50
class Fixnum def gün self * 24 * 60 *
60 end def önce Time.now - self end def sonra Time.now + self end end Time.now # => 2015-01-12 12:30:37 +0200 5.gün.önce # => 2015-01-07 12:30:37 +0200 1.gün.sonra # => 2015-01-13 12:30:37 +0200
PHP?
konuşma dİlİne benzer
5.times do |i| puts "Ruby’i seviyorum, i = #{i}" if
i > 2 end # Ruby’i seviyorum, i = 3 # Ruby’i seviyorum, i = 4
meals = %w[Pizza Döner Kebab] print "Let’s eat here!" unless
meals.include? "Soup" menü'de çorba yoksa yemeğİ burada YİYELİM!
KOD ?
varıable merhaba = "Dünya" # Değişken @merhaba # Instance Variable
@@merhaba # Class Variable $merhaba # Global Variable MERHABA # Constant
ARRAY [] # => [] [1, "Merhaba", 2] # =>
[1, "Merhaba", 2] [[1, 2], ["Merhaba", "Dünya"]] # => [[1, 2], ["Merhaba", "Dünya"]]
hash {} # => {} {:foo => "bar"} # =>
{:foo=>"bar"} # Eski {foo: "bar"} # => {:foo=>"bar"} # Yeni
parantez? def merhaba kullanıcı "Merhaba #{kullanıcı}" end merhaba "vigo" #
=> "Merhaba vigo"
SORU İŞARETİ [].empty? # => true ["vigo", "ezel"].include? "vigo" #
=> true user.admin? # => false
ÜNLEM İŞARETİ isim = "vigo" isim.reverse # => "ogiv" isim
# => "vigo" isim.reverse! # => "ogiv" isim # => "ogiv"
zİNCİRLEME METHODLAR "vigo".reverse.reverse # => "vigo" ["v", "i", "g", "o"].join.reverse.split(//).join.reverse
# => "vigo"
İterasyon [1, "merhaba", 2, "dünya"].each do |eleman| puts eleman end
[1, "merhaba", 2, "dünya"].each {|eleman| puts eleman} # 1 # merhaba # 2 # dünya
İterasyon [1, 2, 3, 4, 5].select{|number| number.even?} # => [2,
4] [1, 2, 3, 4, 5].inject{|sum, number| sum + number} # => 15 [1, 2, 3, 4, 5].map{|number| number * 2} # => [2, 4, 6, 8, 10]
class class Person attr_accessor :age end vigo = Person.new vigo
# => #<Person:0x007f98820e6ab0> vigo.age = 43 vigo # => #<Person:0x007f98820e6ab0 @age=43> vigo.age # => 43
class class Person attr_accessor :age # Getter & Setter def
initialize(name) @name = name end def greet "Hello #{@name}" end end vigo = Person.new "Uğur" vigo.age = 43 vigo # => #<Person:0x007fc2810436c0 @name="Uğur", @age=43> vigo.greet # => "Hello Uğur"
class class Person def initialize(name) @name = name end def
age=(value) @age = value end def age @age end def greet "Hello #{@name}" end end vigo = Person.new "Uğur" vigo.age = 43 Getter Setter attr_accessor :age }
class class Person def is_human? true end end class Cyborg
< Person def is_human? false end end vigo = Person.new # => #<Person:0x007faa7291d268> vigo.is_human? # => true t800 = Cyborg.new # => #<Cyborg:0x007faa7291cbd8> t800.is_human? # => false
module + MIXIN module Greeter def say_hello "Hello #{@name}" end
end class Person include Greeter def initialize(name) @name = name end end vigo = Person.new "Uğur" vigo.say_hello # => "Hello Uğur"
hazırım!
İLERİ SEVİYE KONULAR Meta Programming Monkey Patching Block & Proc
& Lambda Functional Programming
kaynaklar http://www.ruby-doc.org/ http://vigo.gitbooks.io/ruby-101/ http://tryruby.org/ http://rubykoans.com/ https://rubymonk.com/ https://www.ruby-lang.org/en/documentation/quickstart/ https://www.ruby-lang.org/en/documentation/ruby-from-other-languages/
fotoğraflar http://www.sitepoint.com/ https://500px.com/photo/72621187/let-me-fly-by-kshitij-bhardwaj http://www.gratisography.com/