SlideShare uma empresa Scribd logo
1 de 32
Baixar para ler offline
Introduction to Rango
Jakub Stastny aka @botanicus
About me
• Ruby & JavaScript
developer.
• Currently based in
London.
• Working as a
freelancer.
• botanicus.github.com
What is Rango?
• Rack-based light-weight web framework.
• As agnostic and flexible as possible.
• Ruby 1.9 only.
• Provides generators, but doesn’t insist on
any certain structure.
• Inspired by Django & Merb.
• Django terminology: View is called template and
view means an action in controller.
• You can use just whichever subset of Rango
you want and it will work.
• No strict conventions, just recommendations,
often use hooks or strategies.
Boot Process
• Script init.rb should setup environment.
• Work as a runner: ./init.rb myscript.rb
• And as a console: ./init.rb -i
• Or both altogether: ./init.rb -i myscript.rb
• Start web server: ./config.ru
• Rewrite arguments: ./config.ru -s thin
Routers
• Every router based on Rack (via env
[“rango.router.params”]).
• Rango::UrlHelper for url(:post, id)
Rendering
• You don’t need controllers for it:
RenderMixin
• The most low-level rendering layer.
• Template will be evaluated in context of the
third argument which defaults to
Object.new.
• post is defined as a local variable.
ExplicitRendering
• Template will be evaluated in context of
self.scope which you can redefine.
• Data from self.context hash will be available
as local variables.
• Context defaults to {request: self.request}.
ImplicitRendering
• Standard Rails-like rendering.
• Template will be evaluated in context of self,
so you can use.
• Methods as self.request or instance variables
as @post are evaluated on self directly, no
context required.
Template Inheritance
• Much more flexible and cleaner than layout/
view, no hacking around with content_for and a
bunch of partials.
• Just an inheritance: (admin/posts.html => admin/
base.html => base.html).
• The only implementation in Ruby(?)
• Haml-only, because there's no such thing as <%=
method(&block) %> in Erb.
• I recently extracted it to template-inheritance
gem (see my GitHub).
Basic Example
#8 Default value for block
• render “index.html”
• extends “base.html”
will parse base.html
and replace its
blocks by blocks in
index.html
Returning values
• Block can return whichever value via arguments.
• Block returns captured string from &block.
AJAX
• It will render normal page with layout if the
request isn’t AJAX.
• If request is AJAX it will just render index.html.
Haml render everything starting with =, it will
render content block which we can use for
updating part of site via JS.
GenericViews (GV)
• Borrowed from Django.
• Just a reusable Rack apps.
• Can extend router (redirect, defer).
• Just render template Rango::GV.static.
GV: Router Extensions
• Deferred routes: check request and decide
where to route (different actions for
desktop/mobile, for registered/unregistered
users etc).
• Rango::GV.redirect may be useful if your
router doesn’t support it.
HTTP Errors Handling
• Based on exceptions inherited from
Rango::HttpError.
• Error404 resp. NotFound.
• Has status, content_type and headers.
Rango::Controller#rescue_http_error
Rango::Controller#render_http_error 1
Rango::Controller#render_http_error 2
Other useful tools
• Pupu: package manager for assets from GitHub
(pupu install mootools).
• Formidable: because helpers is welcome-back-
to-PHP-mess. Again inspired by Django. Includes
validations (server-side & HTML 5), coercions etc.
• Git-deployer let you deploy via Git (git push
staging-server staging-branch). Similar as
what Heroku use, but this is more generic and you
can use it with your own server.
Links
• Wiki: http://wiki.github.com/botanicus/rango
• Issues: http://github.com/botanicus/rango/issues
• Twitter: http://twitter.com/RangoProject
• http://groups.google.com/group/rango-project
• http://github.com/botanicus/ruby-manor-rango
Thank you for your
attention!

Mais conteúdo relacionado

Mais procurados

Automating Your Daily Tasks with Scripting - RubyConf 2015 Taiwan
Automating Your Daily Tasks with Scripting - RubyConf 2015 TaiwanAutomating Your Daily Tasks with Scripting - RubyConf 2015 Taiwan
Automating Your Daily Tasks with Scripting - RubyConf 2015 TaiwanAdler Hsieh
 
ruby + websocket + haproxy
ruby + websocket + haproxyruby + websocket + haproxy
ruby + websocket + haproxyMathieu Elie
 
Web development basics (Part-5)
Web development basics (Part-5)Web development basics (Part-5)
Web development basics (Part-5)Rajat Pratap Singh
 
Applet Vs Servlet
Applet Vs ServletApplet Vs Servlet
Applet Vs ServletBharat Sahu
 
Web development basics (Part-7)
Web development basics (Part-7)Web development basics (Part-7)
Web development basics (Part-7)Rajat Pratap Singh
 
FITC - Here Be Dragons: Advanced JavaScript Debugging
FITC - Here Be Dragons: Advanced JavaScript DebuggingFITC - Here Be Dragons: Advanced JavaScript Debugging
FITC - Here Be Dragons: Advanced JavaScript DebuggingRami Sayar
 
Fighting Ruby code smell
Fighting Ruby code smellFighting Ruby code smell
Fighting Ruby code smellolegshpynov
 
Ruby projects of interest for DevOps
Ruby projects of interest for DevOpsRuby projects of interest for DevOps
Ruby projects of interest for DevOpsRicardo Sanchez
 
Node.js Patterns and Opinions
Node.js Patterns and OpinionsNode.js Patterns and Opinions
Node.js Patterns and OpinionsIsaacSchlueter
 
Ruby Isn't Just About Rails
Ruby Isn't Just About RailsRuby Isn't Just About Rails
Ruby Isn't Just About RailsAdam Wiggins
 
I18nize Scala programs à la gettext
I18nize Scala programs à la gettextI18nize Scala programs à la gettext
I18nize Scala programs à la gettextNgoc Dao
 
Byte code engineering 21st May Saturday 2016
Byte code engineering   21st May Saturday 2016Byte code engineering   21st May Saturday 2016
Byte code engineering 21st May Saturday 2016Sarath Soman
 

Mais procurados (17)

Ajaxworld07
Ajaxworld07Ajaxworld07
Ajaxworld07
 
Automating Your Daily Tasks with Scripting - RubyConf 2015 Taiwan
Automating Your Daily Tasks with Scripting - RubyConf 2015 TaiwanAutomating Your Daily Tasks with Scripting - RubyConf 2015 Taiwan
Automating Your Daily Tasks with Scripting - RubyConf 2015 Taiwan
 
ruby + websocket + haproxy
ruby + websocket + haproxyruby + websocket + haproxy
ruby + websocket + haproxy
 
Web development basics (Part-5)
Web development basics (Part-5)Web development basics (Part-5)
Web development basics (Part-5)
 
Applet Vs Servlet
Applet Vs ServletApplet Vs Servlet
Applet Vs Servlet
 
How to-node-core
How to-node-coreHow to-node-core
How to-node-core
 
Rubyhosting
RubyhostingRubyhosting
Rubyhosting
 
Ruby on the JVM
Ruby on the JVMRuby on the JVM
Ruby on the JVM
 
Web development basics (Part-7)
Web development basics (Part-7)Web development basics (Part-7)
Web development basics (Part-7)
 
FITC - Here Be Dragons: Advanced JavaScript Debugging
FITC - Here Be Dragons: Advanced JavaScript DebuggingFITC - Here Be Dragons: Advanced JavaScript Debugging
FITC - Here Be Dragons: Advanced JavaScript Debugging
 
Fighting Ruby code smell
Fighting Ruby code smellFighting Ruby code smell
Fighting Ruby code smell
 
Ruby projects of interest for DevOps
Ruby projects of interest for DevOpsRuby projects of interest for DevOps
Ruby projects of interest for DevOps
 
Node.js Patterns and Opinions
Node.js Patterns and OpinionsNode.js Patterns and Opinions
Node.js Patterns and Opinions
 
RubyMotion #jbday
RubyMotion #jbdayRubyMotion #jbday
RubyMotion #jbday
 
Ruby Isn't Just About Rails
Ruby Isn't Just About RailsRuby Isn't Just About Rails
Ruby Isn't Just About Rails
 
I18nize Scala programs à la gettext
I18nize Scala programs à la gettextI18nize Scala programs à la gettext
I18nize Scala programs à la gettext
 
Byte code engineering 21st May Saturday 2016
Byte code engineering   21st May Saturday 2016Byte code engineering   21st May Saturday 2016
Byte code engineering 21st May Saturday 2016
 

Destaque

B2 b marketing agency
B2 b marketing agencyB2 b marketing agency
B2 b marketing agencySMEsOnline
 
Presentation For 572
Presentation For 572Presentation For 572
Presentation For 572lnettels
 
You should brew your own beer
You should brew your own beerYou should brew your own beer
You should brew your own beerSigafoos
 
Volume 3 issue 4 - fall 2011
Volume 3   issue 4 - fall 2011Volume 3   issue 4 - fall 2011
Volume 3 issue 4 - fall 2011NJCRI
 
Ultrasound technician courses
Ultrasound technician coursesUltrasound technician courses
Ultrasound technician coursesultrasc2011
 
אתגר 62 יום לשינוי מערכת היחסים עם האוכל ועם עצמך - 7 תרגילים
אתגר 62 יום לשינוי מערכת היחסים עם האוכל ועם עצמך - 7 תרגיליםאתגר 62 יום לשינוי מערכת היחסים עם האוכל ועם עצמך - 7 תרגילים
אתגר 62 יום לשינוי מערכת היחסים עם האוכל ועם עצמך - 7 תרגיליםאורנה צפריר
 
Osher lifelong learning institute
Osher lifelong learning instituteOsher lifelong learning institute
Osher lifelong learning institutekbyrd1962
 
Saints Sponsor Proposal
Saints Sponsor ProposalSaints Sponsor Proposal
Saints Sponsor Proposalgrantcullen
 
Advanced Social Networking
Advanced Social NetworkingAdvanced Social Networking
Advanced Social NetworkingJessica Levin
 
Hbitosdeestudio 100713121008-phpapp02
Hbitosdeestudio 100713121008-phpapp02Hbitosdeestudio 100713121008-phpapp02
Hbitosdeestudio 100713121008-phpapp02Ernesto Fernandez
 
Twitter for Media Pros Panel
Twitter for Media Pros PanelTwitter for Media Pros Panel
Twitter for Media Pros PanelShawn Graham
 
Trucos del movil
Trucos del movilTrucos del movil
Trucos del moviltodocurioso
 
Intro To Travel Lake Tahoe
Intro To Travel Lake TahoeIntro To Travel Lake Tahoe
Intro To Travel Lake TahoeCory Plough
 
Medienprojekt: Plenum (Einführung) WiSe 2014/15
Medienprojekt: Plenum (Einführung) WiSe 2014/15Medienprojekt: Plenum (Einführung) WiSe 2014/15
Medienprojekt: Plenum (Einführung) WiSe 2014/15Martin Rehm
 

Destaque (20)

Festival of Marketing
Festival of MarketingFestival of Marketing
Festival of Marketing
 
1rubias
1rubias1rubias
1rubias
 
B2 b marketing agency
B2 b marketing agencyB2 b marketing agency
B2 b marketing agency
 
Presentation For 572
Presentation For 572Presentation For 572
Presentation For 572
 
You should brew your own beer
You should brew your own beerYou should brew your own beer
You should brew your own beer
 
Volume 3 issue 4 - fall 2011
Volume 3   issue 4 - fall 2011Volume 3   issue 4 - fall 2011
Volume 3 issue 4 - fall 2011
 
Las redes sociales & moodle
Las redes sociales & moodleLas redes sociales & moodle
Las redes sociales & moodle
 
Con un-boli-bic
Con un-boli-bicCon un-boli-bic
Con un-boli-bic
 
Ultrasound technician courses
Ultrasound technician coursesUltrasound technician courses
Ultrasound technician courses
 
אתגר 62 יום לשינוי מערכת היחסים עם האוכל ועם עצמך - 7 תרגילים
אתגר 62 יום לשינוי מערכת היחסים עם האוכל ועם עצמך - 7 תרגיליםאתגר 62 יום לשינוי מערכת היחסים עם האוכל ועם עצמך - 7 תרגילים
אתגר 62 יום לשינוי מערכת היחסים עם האוכל ועם עצמך - 7 תרגילים
 
Osher lifelong learning institute
Osher lifelong learning instituteOsher lifelong learning institute
Osher lifelong learning institute
 
Saints Sponsor Proposal
Saints Sponsor ProposalSaints Sponsor Proposal
Saints Sponsor Proposal
 
Advanced Social Networking
Advanced Social NetworkingAdvanced Social Networking
Advanced Social Networking
 
Hbitosdeestudio 100713121008-phpapp02
Hbitosdeestudio 100713121008-phpapp02Hbitosdeestudio 100713121008-phpapp02
Hbitosdeestudio 100713121008-phpapp02
 
PERIFÉRICOS MIXTOS
PERIFÉRICOS MIXTOSPERIFÉRICOS MIXTOS
PERIFÉRICOS MIXTOS
 
Twitter for Media Pros Panel
Twitter for Media Pros PanelTwitter for Media Pros Panel
Twitter for Media Pros Panel
 
Presentación
PresentaciónPresentación
Presentación
 
Trucos del movil
Trucos del movilTrucos del movil
Trucos del movil
 
Intro To Travel Lake Tahoe
Intro To Travel Lake TahoeIntro To Travel Lake Tahoe
Intro To Travel Lake Tahoe
 
Medienprojekt: Plenum (Einführung) WiSe 2014/15
Medienprojekt: Plenum (Einführung) WiSe 2014/15Medienprojekt: Plenum (Einführung) WiSe 2014/15
Medienprojekt: Plenum (Einführung) WiSe 2014/15
 

Semelhante a Rango

JRuby, Ruby, Rails and You on the Cloud
JRuby, Ruby, Rails and You on the CloudJRuby, Ruby, Rails and You on the Cloud
JRuby, Ruby, Rails and You on the CloudHiro Asari
 
Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010
Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010
Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010Arun Gupta
 
Java script nirvana in netbeans [con5679]
Java script nirvana in netbeans [con5679]Java script nirvana in netbeans [con5679]
Java script nirvana in netbeans [con5679]Ryan Cuprak
 
JBoss, Rails and the cloud
JBoss, Rails and the cloudJBoss, Rails and the cloud
JBoss, Rails and the cloudelliando dias
 
Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber
       Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber       Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber
Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & CucumberUdaya Kiran
 
React on rails v6.1 at LA Ruby, November 2016
React on rails v6.1 at LA Ruby, November 2016React on rails v6.1 at LA Ruby, November 2016
React on rails v6.1 at LA Ruby, November 2016Justin Gordon
 
MidwestJS 2014 Reconciling ReactJS as a View Layer Replacement
MidwestJS 2014 Reconciling ReactJS as a View Layer ReplacementMidwestJS 2014 Reconciling ReactJS as a View Layer Replacement
MidwestJS 2014 Reconciling ReactJS as a View Layer ReplacementZach Lendon
 
Reconciling ReactJS as a View Layer Replacement (MidwestJS 2014)
Reconciling ReactJS as a View Layer Replacement (MidwestJS 2014)Reconciling ReactJS as a View Layer Replacement (MidwestJS 2014)
Reconciling ReactJS as a View Layer Replacement (MidwestJS 2014)Zach Lendon
 
Killing the Angle Bracket
Killing the Angle BracketKilling the Angle Bracket
Killing the Angle Bracketjnewmanux
 
Gwt and rpc use 2007 1
Gwt and rpc use 2007 1Gwt and rpc use 2007 1
Gwt and rpc use 2007 1Sam Muhanguzi
 
Node.js Development with Apache NetBeans
Node.js Development with Apache NetBeansNode.js Development with Apache NetBeans
Node.js Development with Apache NetBeansRyan Cuprak
 
What’s expected in Java 9
What’s expected in Java 9What’s expected in Java 9
What’s expected in Java 9Gal Marder
 
CouchDB for Web Applications - Erlang Factory London 2009
CouchDB for Web Applications - Erlang Factory London 2009CouchDB for Web Applications - Erlang Factory London 2009
CouchDB for Web Applications - Erlang Factory London 2009Jason Davies
 
Isomorphic JavaScript with Node, WebPack, and React
Isomorphic JavaScript with Node, WebPack, and ReactIsomorphic JavaScript with Node, WebPack, and React
Isomorphic JavaScript with Node, WebPack, and ReactTyler Peterson
 
NodeJS - Server Side JS
NodeJS - Server Side JS NodeJS - Server Side JS
NodeJS - Server Side JS Ganesh Kondal
 

Semelhante a Rango (20)

Rango
RangoRango
Rango
 
Upgrading to rails3
Upgrading to rails3Upgrading to rails3
Upgrading to rails3
 
JRuby, Ruby, Rails and You on the Cloud
JRuby, Ruby, Rails and You on the CloudJRuby, Ruby, Rails and You on the Cloud
JRuby, Ruby, Rails and You on the Cloud
 
Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010
Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010
Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010
 
Java script nirvana in netbeans [con5679]
Java script nirvana in netbeans [con5679]Java script nirvana in netbeans [con5679]
Java script nirvana in netbeans [con5679]
 
JBoss, Rails and the cloud
JBoss, Rails and the cloudJBoss, Rails and the cloud
JBoss, Rails and the cloud
 
Day 8 - jRuby
Day 8 - jRubyDay 8 - jRuby
Day 8 - jRuby
 
Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber
       Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber       Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber
Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber
 
React on rails v6.1 at LA Ruby, November 2016
React on rails v6.1 at LA Ruby, November 2016React on rails v6.1 at LA Ruby, November 2016
React on rails v6.1 at LA Ruby, November 2016
 
MidwestJS 2014 Reconciling ReactJS as a View Layer Replacement
MidwestJS 2014 Reconciling ReactJS as a View Layer ReplacementMidwestJS 2014 Reconciling ReactJS as a View Layer Replacement
MidwestJS 2014 Reconciling ReactJS as a View Layer Replacement
 
Reconciling ReactJS as a View Layer Replacement (MidwestJS 2014)
Reconciling ReactJS as a View Layer Replacement (MidwestJS 2014)Reconciling ReactJS as a View Layer Replacement (MidwestJS 2014)
Reconciling ReactJS as a View Layer Replacement (MidwestJS 2014)
 
Killing the Angle Bracket
Killing the Angle BracketKilling the Angle Bracket
Killing the Angle Bracket
 
How DSL works on Ruby
How DSL works on RubyHow DSL works on Ruby
How DSL works on Ruby
 
React on rails v4
React on rails v4React on rails v4
React on rails v4
 
Gwt and rpc use 2007 1
Gwt and rpc use 2007 1Gwt and rpc use 2007 1
Gwt and rpc use 2007 1
 
Node.js Development with Apache NetBeans
Node.js Development with Apache NetBeansNode.js Development with Apache NetBeans
Node.js Development with Apache NetBeans
 
What’s expected in Java 9
What’s expected in Java 9What’s expected in Java 9
What’s expected in Java 9
 
CouchDB for Web Applications - Erlang Factory London 2009
CouchDB for Web Applications - Erlang Factory London 2009CouchDB for Web Applications - Erlang Factory London 2009
CouchDB for Web Applications - Erlang Factory London 2009
 
Isomorphic JavaScript with Node, WebPack, and React
Isomorphic JavaScript with Node, WebPack, and ReactIsomorphic JavaScript with Node, WebPack, and React
Isomorphic JavaScript with Node, WebPack, and React
 
NodeJS - Server Side JS
NodeJS - Server Side JS NodeJS - Server Side JS
NodeJS - Server Side JS
 

Último

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...apidays
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbuapidays
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusZilliz
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 

Último (20)

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 

Rango

  • 1. Introduction to Rango Jakub Stastny aka @botanicus
  • 2. About me • Ruby & JavaScript developer. • Currently based in London. • Working as a freelancer. • botanicus.github.com
  • 3. What is Rango? • Rack-based light-weight web framework. • As agnostic and flexible as possible. • Ruby 1.9 only. • Provides generators, but doesn’t insist on any certain structure. • Inspired by Django & Merb.
  • 4. • Django terminology: View is called template and view means an action in controller. • You can use just whichever subset of Rango you want and it will work. • No strict conventions, just recommendations, often use hooks or strategies.
  • 5. Boot Process • Script init.rb should setup environment. • Work as a runner: ./init.rb myscript.rb • And as a console: ./init.rb -i • Or both altogether: ./init.rb -i myscript.rb • Start web server: ./config.ru • Rewrite arguments: ./config.ru -s thin
  • 6. Routers • Every router based on Rack (via env [“rango.router.params”]). • Rango::UrlHelper for url(:post, id)
  • 7. Rendering • You don’t need controllers for it:
  • 9. • The most low-level rendering layer. • Template will be evaluated in context of the third argument which defaults to Object.new. • post is defined as a local variable.
  • 11. • Template will be evaluated in context of self.scope which you can redefine. • Data from self.context hash will be available as local variables. • Context defaults to {request: self.request}.
  • 13. • Standard Rails-like rendering. • Template will be evaluated in context of self, so you can use. • Methods as self.request or instance variables as @post are evaluated on self directly, no context required.
  • 14. Template Inheritance • Much more flexible and cleaner than layout/ view, no hacking around with content_for and a bunch of partials. • Just an inheritance: (admin/posts.html => admin/ base.html => base.html). • The only implementation in Ruby(?) • Haml-only, because there's no such thing as <%= method(&block) %> in Erb. • I recently extracted it to template-inheritance gem (see my GitHub).
  • 15. Basic Example #8 Default value for block • render “index.html” • extends “base.html” will parse base.html and replace its blocks by blocks in index.html
  • 16. Returning values • Block can return whichever value via arguments. • Block returns captured string from &block.
  • 17. AJAX
  • 18. • It will render normal page with layout if the request isn’t AJAX. • If request is AJAX it will just render index.html. Haml render everything starting with =, it will render content block which we can use for updating part of site via JS.
  • 19. GenericViews (GV) • Borrowed from Django. • Just a reusable Rack apps. • Can extend router (redirect, defer). • Just render template Rango::GV.static.
  • 20. GV: Router Extensions • Deferred routes: check request and decide where to route (different actions for desktop/mobile, for registered/unregistered users etc). • Rango::GV.redirect may be useful if your router doesn’t support it.
  • 21.
  • 22.
  • 23. HTTP Errors Handling • Based on exceptions inherited from Rango::HttpError. • Error404 resp. NotFound. • Has status, content_type and headers.
  • 27. Other useful tools • Pupu: package manager for assets from GitHub (pupu install mootools). • Formidable: because helpers is welcome-back- to-PHP-mess. Again inspired by Django. Includes validations (server-side & HTML 5), coercions etc. • Git-deployer let you deploy via Git (git push staging-server staging-branch). Similar as what Heroku use, but this is more generic and you can use it with your own server.
  • 28.
  • 29.
  • 30.
  • 31. Links • Wiki: http://wiki.github.com/botanicus/rango • Issues: http://github.com/botanicus/rango/issues • Twitter: http://twitter.com/RangoProject • http://groups.google.com/group/rango-project • http://github.com/botanicus/ruby-manor-rango
  • 32. Thank you for your attention!