Sha256: db5ef78f9216f36f23d6f36377be6e1b26baa361fe36e4cdc86f4705ae634fd0

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

# Flatspace ruby web app helpers
Request helpers for flat space ruby apps running Sinatra.

### Installation
```
gem install flatspace
```
or add to your Gemfile.

### Usage
```ruby
# Include as helper in your Sinatra app
helpers Flatspace::Helpers::Request

# Login redirect unless session[:u] is set
login

# Password is valid?
password_valid?

# HTTP Basic auth authentication
protect!

# Check HTTP Basic authorization
authorized?

# Colorize input green or red
green('text')
red('text')

# Errors, use for request errors
e
e[:id]
e.any?

# Params
p
p[:i]
p[:i] = 'val'

# Flash
f
f[:i]
f[:i] = 'val'

# Session
s
s[:u]
s[:u] = 'val'

# Halt, stop and return
h(val)

# Go, redirect to path
go(path)

# Go with flash[:info]
go(path, :i => 'message')

# Go with flash[:error]
go(path, :e => 'error')

# Show erb view and use flash.now
now(:view)
now(:view, :i => 'message')
now(:view, :f => 'error')
```

Created and maintained by [Fugroup Ltd.](https://www.fugroup.net) We are the creators of [CrowdfundHQ.](https://crowdfundhq.com)

`@authors: Vidar`

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
flatspace-0.0.2 README.md