Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eldoy/flatspace
Request helpers for flat space ruby apps
https://github.com/eldoy/flatspace
Last synced: 6 days ago
JSON representation
Request helpers for flat space ruby apps
- Host: GitHub
- URL: https://github.com/eldoy/flatspace
- Owner: eldoy
- License: mit
- Created: 2016-12-25T23:07:25.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-01-05T23:59:58.000Z (almost 8 years ago)
- Last Synced: 2024-10-27T22:55:00.413Z (18 days ago)
- Language: Ruby
- Size: 7.81 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# 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`