https://github.com/adam12/roda-unpoly
Easily add support to Roda for the server protocol expected by Unpoly
https://github.com/adam12/roda-unpoly
roda
Last synced: 3 months ago
JSON representation
Easily add support to Roda for the server protocol expected by Unpoly
- Host: GitHub
- URL: https://github.com/adam12/roda-unpoly
- Owner: adam12
- Created: 2017-03-04T20:41:45.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2024-12-27T16:22:03.000Z (7 months ago)
- Last Synced: 2025-04-07T05:43:28.049Z (3 months ago)
- Topics: roda
- Language: Ruby
- Size: 47.9 KB
- Stars: 11
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# Unpoly for Roda
Easily add support for the server protocol expected by [Unpoly](http://unpoly.com).
## Installation
Add this line to your application's Gemfile:
```ruby
gem "roda-unpoly"
```And then execute:
$ bundle
Or install it yourself as:
$ gem install roda-unpoly
## Usage
Simply enable the plugin through the `plugin` mechanism.
```ruby
class App < Roda
plugin :unpolyroute do |r|
# Routing tree
end
end
```Inside the routing tree, some convenience methods are made available to work with
the Unpoly request.### Testing for Unpoly request
Use the methods `r.up?`, `r.unpoly?`, `r.up.up?`, or `r.up.unpoly?` (they are
all aliases of the same method).### Testing the Unpoly target
Use the method `r.up.target?(your_target)`.
### Testing for Unpoly validate request
Use the method `r.up.validate?`.
### Setting page title
Use the method `r.up.title=`.
## Where are the Javascript and CSS assets?
I've chosen not to bundle those assets with the gem as they might be updated more
frequently then this library. Roda is also asset-agnostic (for the most part),
so it's easier if you bring in your assets as you see fit for your specific needs.## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/adam12/roda-unpoly.
I love pull requests! If you fork this project and modify it, please ping me to see
if your changes can be incorporated back into this project.That said, if your feature idea is nontrivial, you should probably open an issue to
[discuss it](http://www.igvita.com/2011/12/19/dont-push-your-pull-requests/)
before attempting a pull request.## License
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).