Ruby великолепныйRubyWay
Ruby великолепный2.0.0-p247> parents = [:mom, 'dad',
"grandmom"]
=> [:mom, "dad", "grandmom"]
2.0.0-p247> puts parents[0]mom
2.0.0-p247> puts parents.firstmom
2.0.0-p247> puts parents.lastgrandmom
2.0.0-p247> parents.each do |parent|
2.0.0-p247> puts parent if parent.present?
2.0.0-p247> end
mom
dad
grandmom
> 5.times {
> a = a + 1
> }
=> 5
for (int = 5; i < 5; i++){
a = a + 1
}
Миксиныmodule A
def self.example
:a
end
end
module B def self.example :b endend
Кто последний, тот и папа :)module C
include A
end
def self.example :cend
include B
C.example
=> :aC.example=> :c
C.example=> :b
Как прострелить соседу ногу в 5 строк?class String
def empty?
[true, false].sample
end
end
DSLConfigus.build :development do
env :production do
website_url 'http://example.com'
email do
pop do
address 'pop.example.com'
port 110
end
end
end
end
configus.email.pop.port # => 110
Расширения языка (gems)2.0.0-p247 :020 > date = Date.current => Mon, 04 Nov 2013
2.0.0-p247 :021 > date.years_ago(10) => Tue, 04 Nov 2003
2.0.0-p247 :022 > date + 1.year => Tue, 04 Nov 2014
2.0.0-p247 :024 > date + 5.years - 1.day
=> Tue, 05 Nov 2018
Ruby великолепныйИнфраструктура
Почему руби программисты спят спокойно?
● airbrake.io● errbit
Html? Не, не слышал.<div><h1>Simple table</h1><table><tr><td>1</td><td>2</td></tr></table</div>
%div %h1 Simple table %table %tr %td 1 %td 2
Codeclimat
Rubygems● 65,327 gems● 2,258,366,587 downloads● opensource
На сегодня все ;)Оставьте свое мнение о курсе:https://www.facebook.com/undevschool
Андрей Суббота Вагин Александр
@numbata @plugin73
Top Related