Upgrade to Pro — share decks privately, control downloads, hide ads and more …

[ITeaConf 2021] Как дела, Руби?

[ITeaConf 2021] Как дела, Руби?



Вакансии Злых марсиан: https://career.habr.com/companies/evilmartians

Vladimir Dementyev

November 14, 2021

More Decks by Vladimir Dementyev

Other Decks in Programming


  1. palkan_tula palkan 7 No bothersome semicolons to type mechanically at

    the end of each line No troublesome type declarations to keep in sync (especially in separate files) No unnecessary words just to keep the compiler happy No error-prone framework code
  2. palkan_tula palkan 8 Ruby is designed to make programmers happy

    It allows you to concentrate on the creative side of programming, with less stress Matz (Yukihiro Matsumoto)
  3. palkan_tula palkan Ruby 2021 16 def beach(*temperature) case temperature in

    :celcius | :c, (20 ..45) :favorable in :kelvin | :k, (293 ..318) :scientifically_favorable in :fahrenheit | :f, (68 ..113) :favorable_in_us else :avoid_beach end end
  4. palkan_tula palkan Ruby 2021 18 server = Ractor.new do puts

    "Server sends: ping" Ractor.yield 'ping' received = Ractor.receive puts "Server received: #{received}" end client = Ractor.new(server) do |srv| received = srv.take puts "Client received: #{received}" puts "Client sends: pong" srv.send 'pong' end [client, server].each(&:take) Ractor — Ruby actor
  5. palkan_tula palkan Ruby Type Signatures 20 I hate type annotations

    Аннотации типов — это костыль Если мы добавим типы в язык, то их сложно будет убрать из него в будущем, когда вывод типов будет полностью автоматическим
  6. palkan_tula palkan Ractor 27 Не любит делиться — сложно ему

    будет в нашем мире Ractor.shareable?(1) # => true Ractor.shareable?('foo') # => false Ractor.shareable?('foo'.freeze) # => true
  7. palkan_tula palkan Hotwire 44 Turbo Drive (ex-Turbolinks) и Frames —

    SPA «для бедных» Turbo Streams — обновление HTML через WebSockets Stimulus — «живая вода» для HTML
  8. palkan_tula palkan View Component 50 # app/components/button/component.rb class Button ::Component

    < ViewComponent ::Base attr_reader :label, :icon def initialize(label:, icon: nil) @label = label @icon = icon end alias icon? icon end # app/components/button/component.html.erb <button class="btn"> <% if icon? %> <i><%= icon %> </i> <% end %> <% == label %> </button>
  9. palkan_tula palkan Kuby 58 Kuby.define("anycable-rails-demo") do environment(:production) do app_creds =

    read_creds(:production) docker do credentials do username app_creds[:do_token] password app_creds[:do_token] end image_url "registry.digitalocean.com/anycable/anycable-rails-demo" end kubernetes do add_plugin :rails_app do hostname "kuby-demo.anycable.io" end add_plugin :anycable_rpc add_plugin :anycable_go provider :digitalocean do access_token app_creds[:do_token] cluster_id app_creds[:do_cluster_id] end end end end На выходе сотни строк кода для Docker и Kubernetes kuby setup && kuby build && kuby push && kuby deploy