Sinatra: Up and Running: Ruby for the Web, Simply by Alan Harris

By Alan Harris

Reap the benefits of Sinatra, the Ruby-based internet software library and domain-specific language utilized by GitHub, LinkedIn, Engine backyard, and different favourite corporations. With this concise publication, you'll quick achieve operating wisdom of Sinatra and its minimalist method of development either standalone and modular internet functions. Sinatra serves as a light-weight wrapper round Rack middleware, with syntax that maps heavily to features uncovered via HTTP verbs, which makes it perfect for net companies and APIs. in case you have event development purposes with Ruby, you will quick examine language basics and notice under-the-hood thoughts, with the aid of numerous useful examples. Then you will get hands-on event with Sinatra by means of development your personal web publication engine.

Show description

Read or Download Sinatra: Up and Running: Ruby for the Web, Simply PDF

Similar web programming books

Learning Ext JS 3.2

The ebook presents lots of enjoyable instance code and screenshots to steer you thru the production of examples to aid with studying. via taking a chapter-by-chapter examine each one significant element of the Ext JS framework, the publication allows you to digest the on hand positive factors in small, simply comprehensible chunks, permitting you to begin utilizing the library on your improvement wishes instantly.

Foundation Flex for Developers: Data-Driven Applications with PHP, ASP.NET, ColdFusion, and LCDS

Flex is crucial and flexible expertise for growing internet software front-ends. yet what each reliable net program wishes is a sturdy information resource, be it XML, or a database. Flex is especially adaptable when it comes to connecting to information assets, and that's the major concentration of this ebook. In origin Flex for builders, writer Sas Jacobs assumes that you have got the fundamentals of Flex down already, and explores intimately the best way to create specialist data-centric Flex 2 and Flex three functions.

Dynamic Web programming and HTML5

With companies and participants more and more depending on the internet, the necessity for useful, well-trained internet builders and maintainers is turning out to be. supporting readers grasp net improvement, Dynamic net Programming and HTML5 covers particular net programming languages, APIs, and coding concepts and gives an in-depth knowing of the underlying suggestions, thought, and ideas.

Beginning HTML5 Media: Make the most of the new video and audio standards for the Web

Starting HTML5 Media, moment version is a complete advent to HTML5 video and audio. The HTML5 video common allows browsers to aid audio and video components natively. This makes it really easy for internet builders to put up audio and video, integrating either in the normal presentation of web content.

Additional resources for Sinatra: Up and Running: Ruby for the Web, Simply

Example text

It’s important to be mindful of network traffic and performance with this approach, especially if you’re used to other session storage approaches where only a unique key is stored client-side (with the actual session data stored in memory on the server). clear in your routes to immediately wipe out that user’s session. See Example 2-34. Example 2-34. clear redirect '/fetch' end Cookies Cookies are small amounts of metadata stored client-side. There are essentially two types of cookies: session and persistent.

2-p0 > get('/') { defined? 2-p0 > defined? params => nil As it turns out, params is available only inside the scope of the get block. The secret to Sinatra’s magic is how it handles management of self. The Inner Self In Ruby, method calls that aren’t sent to a variable or constant are actually sent to self; typically self is omitted for brevity. jobs; the output is the same because both calls are made in the same scope and the identity of self is identical. Example 3-2. jobs => #0->irb on main (#: running) The identity of self becomes important when crossing what are known as scope gates; scope gates are sections of code where the context of the executing code changes, and generally self changes accordingly.

Where Does get Come From? So we know now that our routes are passing blocks to instances of Sinatra::Applica tion for evaluation. Where exactly do these route methods live? Let’s open IRB and work with the Ruby reflection API to get a general idea of the class structure as demonstrated in Example 3-4. Example 3-4.

Download PDF sample

Rated 4.62 of 5 – based on 29 votes