Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lunetas

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lunetas

  • 0.1.3
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Lunetas

Lunetas

A Rack based micro framework.

Structure

It is a class-url based framework. It means, that every class describes a route using a Regular Expression. It may respond to one or many HTTP methods. These responses are defined overwritting the methods get, put, post, delete, trace, head, etc.. It can also handle other non-native HTTP methods, using overwritting other_verb.

What does all these means? Checkout an example. (You can also take a look at the examples folder).

Usage

If you are going to use Lunetas as a stand alone Rack application. In order to get it running, you just need to add run Lunetas::Bag in your config.ru file.

If you are going to use Lunetas behind a framework like Rails. You just need to add the gem, require 'lunetas' in your metal, and you are ready to go.

Now with support for public assets, and templates. Check out the example under /examples/stand_alone_app, to see how it works!

Examples

Simple example

require 'lunetas'

class Testing
  include Lunetas::Candy
  matches '/hello/(\w+)', :name

  def before
    @name = @name.capitalize
  end

  def get
    "Hello #{@name}! #{params[:chunky]}"
  end

  def post
    "Hey #{@name}, I see you're testing the POST method :)"
  end
end

class AnotherTest
  include Lunetas::Candy
  matches '^/(\d+)$', :number

  def get
    "Is #{@number} your lucky number?"
  end

  def other_verb(verb)
    if verb == 'TEAPOT'
      "I ain't a teapot!"
    end
  end
end

Defining a custom ContentType

require 'lunetas'
require 'json'

class JaySon
  include Lunetas::Candy
  matches '^/something\.json$'
  set_content_type 'application/json'

  def get
    { :test => true, 'json' => "Yes, JSON", :amount => 1}.to_json
  end
end

FAQs

Package last updated on 03 Dec 2010

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc