Sha256: d9a3f430056b297787326b66081efd7502563df35d7d7ecf5f640787f65870a6

Contents?: true

Size: 1.22 KB

Versions: 1

Compression:

Stored size: 1.22 KB

Contents

Angelo
======

[![Build Status](https://travis-ci.org/kenichi/angelo.png?branch=master)](https://travis-ci.org/kenichi/angelo)

A Sinatra-esque DSL for Reel.

__SUPER ALPHA!__

### Quick example

```ruby
require 'angelo'

class Foo < Angelo::Base

  TEST = {foo: "bar", baz: 123, bat: false}.to_json

  def pong; 'pong'; end
  def foo; params[:foo]; end

  get '/ping' do
    pong
  end

  post '/foo' do
    foo
  end

  post '/bar' do
    params.to_json
  end

  post '/emit' do
    websockets[:emit_test].each {|ws| ws.write TEST}
    params.to_json
  end

  socket '/ws' do |ws|
    websockets[:emit_test] << ws
    while msg = ws.read
      5.times { ws.write TEST }
      ws.write foo.to_json
    end
  end

  post '/other' do
    websockets[:other].each {|ws| ws.write TEST}
  end

  socket '/other/ws' do |ws|
    websockets[:other] << ws
  end

end

Foo.run
```

### Tilt / ERB

To make `erb` available in route blocks

1. add `tilt` to your `Gemfile`:

```ruby
gem 'tilt'
```

2. require `angelo/tilt/erb`
3. include `Angelo::Tilt::ERB` in your app

```ruby
class Foo < Angelo::Base
  include Angelo::Tilt::ERB

  @@views = 'some/other/path' # defaults to './views'

  get '/' do
    erb :index
  end

end
```

### License

see LICENSE

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
angelo-0.0.7 README.md