за ruby
DESCRIPTION
Презентация от initLabTRANSCRIPT
![Page 2: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/2.jpg)
![Page 3: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/3.jpg)
♥?
&&
![Page 4: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/4.jpg)
![Page 5: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/5.jpg)
ЗЛО! АНАТЕМА!
![Page 6: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/6.jpg)
![Page 7: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/7.jpg)
![Page 8: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/8.jpg)
3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198938095257201065485863278865936153381827968230301952035301852968995773622599413891249721775283479131515574857242454150695950829533116861727855889075098381754637464939319255060400927701671139009848824012858361603563707660104710181942955596198946767837449448255379774726847104047534646208046684259069491293313677028989152104752162056966024058038150193511253382430035587640247496473263914199272604269922796782354781636009341721641219924586315030286182974555706749838505494588586926995690927210797509302955
![Page 9: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/9.jpg)
instance Show Board where show (Board ps) = let ordered = (sort . swap) ps ranks = map (showRank ordered) [8,7..1] board = intersperse "--+--+--+--+--+--+--+--" ranks rlabels = intersperse " " (map (\n->(show n)++" ") [8,7..1]) flabels = " a b c d e f g h" in unlines $ zipWith (++) rlabels board ++ [flabels] where swap = map (\(a,b)->(b,a)) showRank ps r = let rnk = filter (\(p,_)->(rank p)==r) ps cs = map (showPiece rnk) [A .. H] in concat (intersperse "|" cs) showPiece ps f = maybe " " (show . snd) (find (\(p,_)->(file p)==f) ps)
![Page 10: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/10.jpg)
![Page 11: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/11.jpg)
![Page 12: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/12.jpg)
ЗаСтефан Кънев -- 28 май -- initLab
![Page 13: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/13.jpg)
Защо?
&&
![Page 14: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/14.jpg)
![Page 15: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/15.jpg)
![Page 16: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/16.jpg)
• Налага се да работиш извънработно време. Като проститутка.
![Page 17: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/17.jpg)
• Налага се да работиш извънработно време. Като проститутка.
• Обикновенно работиш до късно. Като проститутка.
![Page 18: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/18.jpg)
• Налага се да работиш извънработно време. Като проститутка.
• Обикновенно работиш до късно. Като проститутка.
• Никога няма да започнеш да се гордееш с работата си. Като проститутка.
![Page 19: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/19.jpg)
• Налага се да работиш извънработно време. Като проститутка.
• Обикновенно работиш до късно. Като проститутка.
• Никога няма да започнеш да се гордееш с работата си. Като проститутка.
• Когато те питат с какво се занимаваш - не можеш да обясниш. Като проститутка.
![Page 20: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/20.jpg)
• Налага се да работиш извънработно време. Като проститутка.
• Обикновенно работиш до късно. Като проститутка.
• Никога няма да започнеш да се гордееш с работата си. Като проститутка.
• Когато те питат с какво се занимаваш - не можеш да обясниш. Като проститутка.
• В края края на крайщата се чувстваш сякаш си се измъкнал от ада. Като проститутка.
![Page 21: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/21.jpg)
• Налага се да работиш извънработно време. Като проститутка.
• Обикновенно работиш до късно. Като проститутка.
• Никога няма да започнеш да се гордееш с работата си. Като проститутка.
• Когато те питат с какво се занимаваш - не можеш да обясниш. Като проститутка.
• В края края на крайщата се чувстваш сякаш си се измъкнал от ада. Като проститутка.
• Ако нещо не е както трябва, виновният си ти. Като проститутка.
![Page 22: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/22.jpg)
• Налага се да работиш извънработно време. Като проститутка.
• Обикновенно работиш до късно. Като проститутка.
• Никога няма да започнеш да се гордееш с работата си. Като проститутка.
• Когато те питат с какво се занимаваш - не можеш да обясниш. Като проститутка.
• В края края на крайщата се чувстваш сякаш си се измъкнал от ада. Като проститутка.
• Ако нещо не е както трябва, виновният си ти. Като проститутка.
• И се питаш накрая: "АБЕ, аз системен администратор ли съм или ....?"
![Page 23: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/23.jpg)
s/сис админ/програмист/
![Page 24: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/24.jpg)
![Page 25: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/25.jpg)
Занаят
![Page 26: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/26.jpg)
ЗанаятПредизвикателство
![Page 27: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/27.jpg)
ЗанаятПредизвикателство
Изкуство
![Page 28: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/28.jpg)
Fun
![Page 29: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/29.jpg)
![Page 30: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/30.jpg)
C#AspectJGroovyPerl
Python
![Page 31: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/31.jpg)
Ruby
![Page 32: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/32.jpg)
class < ProgrammingLanguage
![Page 33: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/33.jpg)
class < ProgrammingLanguage is_not :rails
![Page 34: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/34.jpg)
class < ProgrammingLanguage is_not :rails is :general_purpose
![Page 35: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/35.jpg)
class < ProgrammingLanguage is_not :rails is :general_purpose is :dynamic
![Page 36: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/36.jpg)
class < ProgrammingLanguage is_not :rails is :general_purpose is :dynamic kicks_ass
![Page 37: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/37.jpg)
class < ProgrammingLanguage is_not :rails is :general_purpose is :dynamic kicks_assend
![Page 38: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/38.jpg)
duck typing
динамичен
обектно-ориентиран
интерпретира се
general purpose
ала Perl и Python
вдъхновен от Perl, Smalltalk, CLU и Lisp
![Page 39: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/39.jpg)
+
![Page 40: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/40.jpg)
ООП
![Page 41: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/41.jpg)
regarding(:oop) { "Ruby" > "Python"}
![Page 42: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/42.jpg)
![Page 43: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/43.jpg)
print reverse "dog";
![Page 44: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/44.jpg)
print reverse "dog";> dog
![Page 45: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/45.jpg)
print reverse "dog";> dog
print ucfirst reverse "dog";
![Page 46: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/46.jpg)
print reverse "dog";> dog
print ucfirst reverse "dog";> God
![Page 47: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/47.jpg)
regarding(:readability) { "Ruby" > "Perl"}
![Page 48: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/48.jpg)
Динамичен
![Page 49: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/49.jpg)
![Page 50: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/50.jpg)
≠
![Page 51: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/51.jpg)
![Page 52: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/52.jpg)
Идеология
![Page 53: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/53.jpg)
Matz
![Page 54: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/54.jpg)
Treating Code As an Essay
•Brevity
•Simplicity
•Balance
![Page 55: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/55.jpg)
Programs must bewritten for people
to read,and only incidentally
for machines toexecute
![Page 56: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/56.jpg)
Ruby.syntax
![Page 57: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/57.jpg)
# Променливи и константиsavings = 1729savings = savings - 42PI = 3.1415
![Page 58: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/58.jpg)
# Условни конструкцииif price < 100 savings -= price will_buy = yeselse will_buy = noend
![Page 59: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/59.jpg)
# Циклиwhile savings > 1000 product, cost = find_cool_stuff() buy(product) savings -= costend
![Page 60: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/60.jpg)
# Unless и Untilunless hungry continue_programming()end
until broke buy_stuff()end
![Page 61: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/61.jpg)
# Като модификаториbuy(product) if price < 100continue_programming() unless hungrybuy_another() while savings > 1000buy_stuff() until broke
![Page 62: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/62.jpg)
# Вградени типовеprimes = [2, 3, 5, 7, 11, 13]names = ["Matz", "DHH", "_why"]family_names = { "Yukihiro" => "Matsumoto", "David" => "Heinemeier Hanson", "_why" => "the lucky stiff",}regex = /(bb|[^b]{2})/
![Page 63: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/63.jpg)
# Итерацияprimes = [2, 3, 5, 7, 11, 13]for n in primes puts nend
primes.each do |n| puts nend
![Page 64: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/64.jpg)
# Функцииdef factorial(n) if n <= 1 return 1 else return n * factorial(n - 1) endend
factorial(5)
![Page 65: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/65.jpg)
# Функции (2)def double(n) n + nend
double(5) == 10
![Page 66: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/66.jpg)
# Всичко е изразclassification = if price > 1000 "Expensive" elsif price > 300 "Normal" else "Cheap" end
![Page 67: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/67.jpg)
# Функции (3)def factorial(n) if n <= 1 1 else n * factorial(n - 1) endend
![Page 68: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/68.jpg)
# Функционално програмиранеactive_emails = []for user in users if user.active? active_emails << user.email endend
![Page 69: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/69.jpg)
# Функционално програмиране (2)active_users = users.select { |user| user.active? }active_emails = active_users.map { |user| user.email }
![Page 70: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/70.jpg)
# Функционално програмиране (3)active_users = users.select { |user| user.active? }active_emails = active_users.map { |user| user.email }
active_emails = users.select { |u| u.active? }.map { |u| u.email }active_emails = users.select(&:active?).map(&:email)
![Page 71: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/71.jpg)
# Обектно-ориентирано програмиранеa = Vector.new(0, 1, 0)b = Vector.new(1, 0, 1)product = a * blen = (a.x*a.x + a.y*a.y + a.z*a.z) ** 0.5
![Page 72: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/72.jpg)
# Обектно-ориентирано програмиране (2)class Vector def initialize(x, y, z) @x = x @y = y @z = z end def len (@x * @x + @y * @y + @z * @z) ** 0.5 end def *(other) ... endend
![Page 73: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/73.jpg)
# Обектно-ориентирано програмиране (3)class Vector def x() @x end def x=(val) @x = val endend
a = Vector(0, 1, 0)puts a.xputs a.x()a.x = 10a.x=(10)
![Page 74: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/74.jpg)
# Обектно-ориентирано програмиране (4)class Vector attr_accessor :x attr_accessor :yend
![Page 75: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/75.jpg)
# Корутиниwrite_to = users.select { |u| u.active? }.map { |u| u.email }
primes = [1, 2, 3, 5, 7, 11, 13]sum = primes.inject { |a, b| a + b }
open("foo.txt", "w") do |file| primes.each do |prime| file.write prime.to_s endend
![Page 76: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/76.jpg)
# Корутини (2)def do_twice yield yieldend
do_twice { puts "Ruby rocks!" }
![Page 77: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/77.jpg)
# Корутини (3)def filter(things) result = [] things.each do |thing| result << thing if yield(thing) end resultend
filter([3, 5, 7, 11, 13, 17]) { |x| x > 10 }
![Page 78: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/78.jpg)
# Всички прости числа до 1002.upto(100) do |n| puts n if (2...n).all? { |x| n % x != 0 }end
![Page 79: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/79.jpg)
# Mix-inmodule FunctionalStuff def map result = [] self.each { |item| result << yield(item) } result end def select result = [] self.each { |item| result << item if yield(item) } result endend
class PrimesUpTo include FunctionalStuff def each ... endend
![Page 80: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/80.jpg)
# Monkey patchclass Integer def factorial() (1..self).inject { |a, b| a * b } endend
puts 5.factorial
![Page 81: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/81.jpg)
arr = [ "Freddie", "Herbie", "Ron", "Max", "Ringo" ]callcc{|$cc|}puts(message = arr.shift)$cc.call unless message =~ /Max/
# Freddie# Herbie# Ron# Max
![Page 82: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/82.jpg)
callcc {|cont| for i in 0..4 print "\n#{i}: " for j in i*5...(i+1)*5 cont.call() if j == 17 printf "%3d", j end end}print "\n"
#0: 0 1 2 3 4#1: 5 6 7 8 9#2: 10 11 12 13 14#3: 15 16
![Page 83: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/83.jpg)
(->_{_%_})['(->_{%%}_)[%p]']
![Page 84: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/84.jpg)
На практика
![Page 85: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/85.jpg)
DomainSpecificLanguages
![Page 86: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/86.jpg)
RSpecdescribe Stack do before(:each) do @stack = Stack.new [1, 2, 3, 4].each { |n| @stack << n } end it "should have all items in reversed order" do @stack.should_not be_empty @stack.should have(4).items @stack.items.should == [4, 3, 2, 1] end it "should be empty if emptied" do 4.times { @stack.pop } @stack.should be_empty @stack.should have(:no).items endend
![Page 87: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/87.jpg)
ShoesShoes.app do background "#eee" @list = stack do para "Enter a URL to download:", :margin => [10, 8, 10, 0] flow :margin => 10 do @url = edit_line :width => -120 button "Download", :width => 120 do @list.append do stack do background "#eee".."#ccd" stack :margin => 10 do dl = nil para @url.text, " [", link("cancel") { dl.abort }, "]", :margin => 0 d = inscription "Beginning transfer.", :margin => 0 p = progress :width => 1.0, :height => 14 dl = download @url.text, :save => File.basename(@url.text), :progress => proc { |dl| d.text = "Transferred #{dl.transferred} of #{dl.length} b (#{dl.percent}%)" p.fraction = dl.percent * 0.01 }, :finish => proc { |dl| d.text = "Download completed" } end end end end end endend
![Page 88: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/88.jpg)
ActiveRecordclass User < ActiveRecord::Base
validates_presence_of :name, :faculty_number, :email validates_presence_of :password, :if => :password_required? validates_presence_of :password_confirmation, :if => :password_required? validates_length_of :password, :within => 4..40, :if => :password_required? validates_confirmation_of :password, :if => :password_required? validates_length_of :email, :within => 3..100 validates_uniqueness_of :email, :case_sensitive => false before_save :encrypt_password
file_column :picture, :magick => { :geometry => "100x100>" }
has_many :solutions has_many :topics has_many :replies belongs_to :project
end
![Page 89: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/89.jpg)
![Page 90: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/90.jpg)
Culture
![Page 91: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/91.jpg)
≈
![Page 92: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/92.jpg)
Innovation
![Page 93: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/93.jpg)
ИноваториПсихопати
![Page 94: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/94.jpg)
Anti-professionalismUn-professionalism
Elitism
![Page 95: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/95.jpg)
![Page 96: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/96.jpg)
Леко аматьорска(само мъничко)
![Page 97: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/97.jpg)
Interpreters:MRIYARVJRuby
Rubinius
![Page 98: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/98.jpg)
Resources
![Page 100: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/100.jpg)
![Page 101: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/101.jpg)
![Page 102: за Ruby](https://reader034.vdocuments.mx/reader034/viewer/2022052412/558ea5e01a28abe7798b45e7/html5/thumbnails/102.jpg)