Haskell library to parse a subset of Ruby objects serialised with Marshal.dump.
NilClassTrueClass | FalseClassArrayFixnumFloatHashStringSymbol
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.
{-# LANGUAGE OverloadedStrings #-}
moduleMainwhereimportData.Ruby.MarshalimportData.ByteString (ByteString)
importSystem.Directory (getCurrentDirectory)
importqualifiedData.ByteStringasBSimportqualifiedData.Map.StrictasDMlookupUserID:: (ByteString, RubyStringEncoding)
->RubyObject->Maybe (ByteString, RubyStringEncoding)
lookupUserID key hash = fromRuby hash >>=\cookie ->DM.lookup key cookie
main::IO()
main =do
dir <- getCurrentDirectory
rbs <-BS.readFile (mconcat [dir, "/test/bin/railsCookie.bin"])
print$case decode rbs ofJust cookie -> lookupUserID ("user_id", UTF_8) cookie
Nothing->Nothing- Fork it.
- Create your feature branch (
git checkout -b my-new-feature). - Commit your changes (
git commit -am 'Add some feature'). - Push to the branch (
git push origin my-new-feature). - Create new Pull Request.