Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mcfilib/ruby-marshal
Haskell library to parse a subset of Ruby objects serialised with Marshal.dump
https://github.com/mcfilib/ruby-marshal
haskell parsing ruby serialization
Last synced: 25 days ago
JSON representation
Haskell library to parse a subset of Ruby objects serialised with Marshal.dump
- Host: GitHub
- URL: https://github.com/mcfilib/ruby-marshal
- Owner: mcfilib
- License: mit
- Created: 2015-04-11T15:07:00.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2022-10-11T00:20:51.000Z (about 2 years ago)
- Last Synced: 2024-03-15T07:23:48.625Z (8 months ago)
- Topics: haskell, parsing, ruby, serialization
- Language: Haskell
- Homepage:
- Size: 229 KB
- Stars: 31
- Watchers: 5
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# ruby-marshal
[![Build Status](https://travis-ci.org/mcfilib/ruby-marshal.svg?branch=master)](https://travis-ci.org/mcfilib/ruby-marshal)
Haskell library to parse a subset of Ruby objects serialised with Marshal.dump.
## Supported Types
- `NilClass`
- `TrueClass | FalseClass`
- `Array`
- `Fixnum`
- `Float`
- `Hash`
- `String`
- `Symbol`If you would like to add support for another type, please feel free to
create an issue or open a pull request using the guidelines below.## Usage
### Example
``` haskell
{-# LANGUAGE OverloadedStrings #-}module Main where
import Data.Ruby.Marshal
import Data.ByteString (ByteString)
import System.Directory (getCurrentDirectory)import qualified Data.ByteString as BS
import qualified Data.Map.Strict as DMlookupUserID :: (ByteString, RubyStringEncoding)
-> RubyObject
-> Maybe (ByteString, RubyStringEncoding)
lookupUserID key hash = fromRuby hash >>= \cookie -> DM.lookup key cookiemain :: IO ()
main = do
dir <- getCurrentDirectory
rbs <- BS.readFile (mconcat [dir, "/test/bin/railsCookie.bin"])
print $
case decode rbs of
Just cookie -> lookupUserID ("user_id", UTF_8) cookie
Nothing -> Nothing
```## Contributing
1. Fork it.
2. Create your feature branch (`git checkout -b my-new-feature`).
3. Commit your changes (`git commit -am 'Add some feature'`).
4. Push to the branch (`git push origin my-new-feature`).
5. Create new Pull Request.### Contributors
- [@mcfilib](https://github.com/mcfilib)
- [@adinapoli](https://github.com/adinapoli)
- [@kanishka-azimi](https://github.com/kanishka-azimi)
- [@zyla](https://github.com/zyla)
- [@etherz10](https://github.com/etherz10)
- [@JackKelly-Bellroy](https://github.com/JackKelly-Bellroy)## Similar Libraries
- [adjust/gorails](https://github.com/adjust/gorails)
- [instore/node-marshal](https://github.com/instore/node-marshal)
- [mfz/ruby-marshal](https://code.google.com/p/mfz-ruby-marshal)
- [noxyu3m/erlang-ruby-marshal](https://github.com/noxyu3m/erlang-ruby-marshal)