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
82
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Introducción a Cuba
Workshop given in Ruby Fun Day Argentina 2013
Francesco Rodríguez
November 26, 2013
More Decks by Francesco Rodríguez
See All by Francesco Rodríguez
A Minimalistic Ruby Stack
frodsan
1
71
Web Development with Cuba - Ruby Fun Day 2014
frodsan
0
140
Web Security 101 - Ruby Fun Day 2014
frodsan
0
120
Introduction to Cuba
frodsan
1
74
Aprende a Programar
frodsan
0
190
Metaprogramming: From Zero to Hero. (URU meetup)
frodsan
1
140
Other Decks in Programming
See All in Programming
How I Won Prize Money at a Hackathon Using Codex and Symphony Alpha
yasei_no_otoko
0
130
AI駆動開発にグラフDBを重ねてみた
satoshi256kbyte
1
390
生成AIで帳票OCRが「簡単に」作れる時代になった?
kon_shou
0
1.2k
Go を使い始めて 2 ヶ月の学び / My first two months with Go
contour_gara
0
400
Cloudflare is Agents
chimame
0
180
まずはプロンプトガイドを読もう、話はそれからだ
kiakiraki
1
230
【QA Test Talk Vol.8】AI-DLC による Whole Team Approach の加速
pkshadeck
PRO
0
250
Oxlintはいいぞ(続)
yug1224
1
480
Go 1.27からのGODEBUG / Go 1.27 リリースパーティ #go127party
mazrean
0
260
リアルな遅延を測る仕様
kota_yata
1
130
不幸な GC
chencmd
0
820
in-process GraphQL のすすめ #ginzajs
izumin5210
4
1.5k
Featured
See All Featured
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
290
Faster Mobile Websites
deanohume
310
32k
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
480
Accessibility Awareness
sabderemane
1
180
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
580
Evolving SEO for Evolving Search Engines
ryanjones
0
270
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Between Models and Reality
mayunak
4
410
Six Lessons from altMBA
skipperchong
29
4.5k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.1k
WCS-LA-2024
lcolladotor
0
810
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
250
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