All Projects → mcfilib → ruby-marshal

mcfilib / ruby-marshal

Licence: MIT License
Haskell library to parse a subset of Ruby objects serialised with Marshal.dump

Programming Languages

haskell
3896 projects
ruby
36898 projects - #4 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to ruby-marshal

Firely Net Sdk
The official Firely .NET SDK for HL7 FHIR
Stars: ✭ 560 (+1766.67%)
Mutual labels:  serialization, parsing
dataconf
Simple dataclasses configuration management for Python with hocon/json/yaml/properties/env-vars/dict support.
Stars: ✭ 40 (+33.33%)
Mutual labels:  serialization, parsing
Jsoniter Scala
Scala macros for compile-time generation of safe and ultra-fast JSON codecs
Stars: ✭ 410 (+1266.67%)
Mutual labels:  serialization, parsing
Core
🌎 Utility package containing tools for byte manipulation, Codable, OS APIs, and debugging.
Stars: ✭ 62 (+106.67%)
Mutual labels:  serialization, parsing
Mini Yaml
Single header YAML 1.0 C++11 serializer/deserializer.
Stars: ✭ 79 (+163.33%)
Mutual labels:  serialization, parsing
wasmbin
A self-generating WebAssembly parser & serializer in Rust.
Stars: ✭ 40 (+33.33%)
Mutual labels:  serialization, parsing
sexp-grammar
Invertible parsing for S-expressions
Stars: ✭ 28 (-6.67%)
Mutual labels:  serialization, parsing
statham-schema
Statham is a Python Model Parsing Library for JSON Schema.
Stars: ✭ 21 (-30%)
Mutual labels:  serialization, parsing
tangle-rs
a collection of tools to do tangle in rust
Stars: ✭ 23 (-23.33%)
Mutual labels:  parsing
cbor-d
Concise Binary Object Representation (CBOR) binary data format for D language
Stars: ✭ 20 (-33.33%)
Mutual labels:  serialization
siemstress
Very basic CLI SIEM (Security Information and Event Management system).
Stars: ✭ 24 (-20%)
Mutual labels:  parsing
lua-luaepnf
Extended PEG Notation Format (easy grammars for LPeg)
Stars: ✭ 21 (-30%)
Mutual labels:  parsing
protobuf-d
Protocol Buffers Compiler Plugin and Support Library for D
Stars: ✭ 32 (+6.67%)
Mutual labels:  serialization
URSA
[DEPRECATED] integrated ECS framework for Unity
Stars: ✭ 30 (+0%)
Mutual labels:  serialization
kolasu
Kotlin Language Support – AST Library
Stars: ✭ 45 (+50%)
Mutual labels:  parsing
octet
A library that makes working with bytebuffers painless.
Stars: ✭ 79 (+163.33%)
Mutual labels:  parsing
hs-packer
Fast serialization in haskell
Stars: ✭ 13 (-56.67%)
Mutual labels:  serialization
CYK-Parser
A CYK parser written in Python 3.
Stars: ✭ 24 (-20%)
Mutual labels:  parsing
crystalizer
(De)serialize any Crystal object - out of the box. Supports JSON, YAML and Byte format.
Stars: ✭ 32 (+6.67%)
Mutual labels:  serialization
loquat
Monadic parser combinators for JavaScript / TypeScript
Stars: ✭ 47 (+56.67%)
Mutual labels:  parsing

ruby-marshal

Build Status

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

{-# 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 DM

lookupUserID :: (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 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

Similar Libraries

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].