Skip to content

eldoy/flatspace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flatspace ruby web app helpers

Request helpers for flat space ruby apps running Sinatra.

Installation

gem install flatspace

or add to your Gemfile.

Usage

# 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. We are the creators of CrowdfundHQ.

@authors: Vidar

About

Request helpers for flat space ruby apps

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages