Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Introducción a Cuba
Search
Francesco Rodríguez
November 26, 2013
Programming
0
73
Introducción a Cuba
Workshop given in Ruby Fun Day Argentina 2013
Francesco Rodríguez
November 26, 2013
Tweet
Share
More Decks by Francesco Rodríguez
See All by Francesco Rodríguez
A Minimalistic Ruby Stack
frodsan
1
58
Web Development with Cuba - Ruby Fun Day 2014
frodsan
0
120
Web Security 101 - Ruby Fun Day 2014
frodsan
0
110
Introduction to Cuba
frodsan
1
58
Aprende a Programar
frodsan
0
170
Metaprogramming: From Zero to Hero. (URU meetup)
frodsan
1
130
Other Decks in Programming
See All in Programming
Trem on Rails - Prompt Engineering com Ruby
elainenaomi
1
100
AIレビュアーをスケールさせるには / Scaling AI Reviewers
technuma
2
240
MCPで実現するAIエージェント駆動のNext.jsアプリデバッグ手法
nyatinte
7
1k
Ruby×iOSアプリ開発 ~共に歩んだエコシステムの物語~
temoki
0
200
時間軸から考えるTerraformを使う理由と留意点
fufuhu
12
4.1k
TanStack DB ~状態管理の新しい考え方~
bmthd
2
460
ECS初心者の仲間 – TUIツール「e1s」の紹介
keidarcy
0
150
オープンセミナー2025@広島「君はどこで動かすか?」アンケート結果
satoshi256kbyte
0
240
Testing Trophyは叫ばない
toms74209200
0
560
Microsoft Orleans, Daprのアクターモデルを使い効率的に開発、デプロイを行うためのSekibanの試行錯誤 / Sekiban: Exploring Efficient Development and Deployment with Microsoft Orleans and Dapr Actor Models
tomohisa
0
230
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
190
レガシープロジェクトで最大限AIの恩恵を受けられるようClaude Codeを利用する
tk1351
4
1.6k
Featured
See All Featured
Intergalactic Javascript Robots from Outer Space
tanoku
272
27k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.8k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
1.5k
Building a Modern Day E-commerce SEO Strategy
aleyda
43
7.5k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
1.9k
Code Reviewing Like a Champion
maltzj
525
40k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
Rebuilding a faster, lazier Slack
samanthasiow
83
9.1k
jQuery: Nuts, Bolts and Bling
dougneiner
64
7.9k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
46
7.6k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
34
6k
Transcript
None
Introducción a Cuba
Francesco Rodríguez @frodsan
None
“¿Qué es Cuba?”
github.com/soveran/cuba (‛ƅ㱼ƅ)‛ <200 LOC
Mapper simple ! require 'cuba' ! Cuba.define do on '/'
do res.write 'ᕦ(ò_óˇ)ᕤ' end end ! run Cuba
Mapper simple ! require 'cuba' ! Cuba.define do on '/'
do res.write 'ᕦ(ò_óˇ)ᕤ' end end ! run Cuba
Mapper simple ! require 'cuba' ! Cuba.define do on '/'
do res.write 'ᕦ(ò_óˇ)ᕤ' end end ! run Cuba
Mapper simple ! require 'cuba' ! Cuba.define do on '/'
do res.write 'ᕦ(ò_óˇ)ᕤ' end end ! run Cuba
Mapper simple ! require 'cuba' ! Cuba.define do on '/'
do res.write 'ᕦ(ò_óˇ)ᕤ' end end ! run Cuba
Mapper simple ! $ rackup config.ru … * Listening on
tcp://0.0.0.0:9292 ! $ curl http://localhost:9292/ ᕦ(ò_óˇ)ᕤ
Routing Basics
Matching Rules ! ! Cuba.define do # PATH == /
on '/' do res.write 'Home' end end
Matching Rules ! ! Cuba.define do on true do #
on default do res.write 'Home' end end
Matching Rules ! ! Cuba.define do on true do #
este bloque se ejecuta. res.write 'Home' end ! on false do # este bloque no se ejecuta. res.write 'Never do this at home' end end
Matching Rules ! ! Cuba.define do on true do #
este bloque se ejecuta. res.write 'Home' end ! on true do # este bloque no se ejecuta. res.write 'Never do this at home' end end
Matching Rules ! ! Cuba.define do on false do #
este bloque no se ejecuta. res.write 'Meh' end ! on true, false do # este bloque tampoco se ejecuta. res.write 'Meh' end ! on true do # este bloque se ejecuta. res.write 'Finalmente' end end
Dynamic Segments ! ! Cuba.define do ! on favorites/:name do
|name| res.write name end ! end
Parameters ! ! Cuba.define do ! on 'login', param(‘user’), param(‘pass')
do |user, pass| ! User.authenticate(user, pass) ! end ! end
HTTP Verbs Constraints ! ! Cuba.define do on get do
end ! on post do end ! on put do end ! on delete do end end
Composition ! ! Cuba.define do on '/gems' do on get,
root do end ! on new' do end ! on 'status/:status' do |status| end end end
Composition ! ! class Gems < Cuba define do on
get, root do end ! on 'new' do end ! on 'status/:status' do |status| end end end
Composition ! ! Cuba.define do on '/gems' do run Gems
end end
Cuba Recipes github.com/frodsan/cuba-recipes
Cuba Example github.com/frodsan/cuba-example
Ejemplos
ready4rails4.net github.com/rubyperu/ready4rails 413 additions and 1,459 deletions.
redis.io github.com/antirez/redis-io
Punchgirls’ Job Board github.com/punchgirls/job_board
Recursos
Comunidad #cuba.rb en IRC
Links frodsan.com/recursos-cuba
Gracias! CubaConfAr <3
Gracias! RubyConfAr <3