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
72
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
55
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
56
Aprende a Programar
frodsan
0
170
Metaprogramming: From Zero to Hero. (URU meetup)
frodsan
1
130
Other Decks in Programming
See All in Programming
코딩 에이전트 체크리스트: Claude Code ver.
nacyot
0
690
『自分のデータだけ見せたい!』を叶える──Laravel × Casbin で複雑権限をスッキリ解きほぐす 25 分
akitotsukahara
2
640
Google Agent Development Kit でLINE Botを作ってみた
ymd65536
2
260
MCPを使ってイベントソーシングのAIコーディングを効率化する / Streamlining Event Sourcing AI Coding with MCP
tomohisa
0
120
脱Riverpod?fqueryで考える、TanStack Queryライクなアーキテクチャの可能性
ostk0069
0
260
Modern Angular with Signals and Signal Store:New Rules for Your Architecture @enterJS Advanced Angular Day 2025
manfredsteyer
PRO
0
230
Advanced Micro Frontends: Multi Version/ Framework Scenarios @WAD 2025, Berlin
manfredsteyer
PRO
0
280
猫と暮らす Google Nest Cam生活🐈 / WebRTC with Google Nest Cam
yutailang0119
0
160
たった 1 枚の PHP ファイルで実装する MCP サーバ / MCP Server with Vanilla PHP
okashoi
1
270
AIと”コードの評価関数”を共有する / Share the "code evaluation function" with AI
euglena1215
1
170
チームで開発し事業を加速するための"良い"設計の考え方 @ サポーターズCoLab 2025-07-08
agatan
1
440
#QiitaBash MCPのセキュリティ
ryosukedtomita
1
1.4k
Featured
See All Featured
Build your cross-platform service in a week with App Engine
jlugia
231
18k
Documentation Writing (for coders)
carmenintech
72
4.9k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
281
13k
Done Done
chrislema
184
16k
RailsConf 2023
tenderlove
30
1.1k
Raft: Consensus for Rubyists
vanstee
140
7k
Fireside Chat
paigeccino
37
3.5k
Practical Orchestrator
shlominoach
189
11k
Faster Mobile Websites
deanohume
307
31k
Testing 201, or: Great Expectations
jmmastey
43
7.6k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
Facilitating Awesome Meetings
lara
54
6.4k
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