Project

zeamays

0.0
No commit activity in last 3 years
No release in over 3 years
Simple Persistation Any Data for Ruby.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.6
>= 0
>= 0
 Project Readme

Zeamays

Build Status

Zeamays is simple serialization for Ruby.

https://rubygems.org/gems/zeamays

Usage

Declare Model

Declare for Modeling. example at

class YellowSweet < Zeamays::Cob
  gene_sequencing :i8, :i16, :integer, :string
end

This is RDB Table like declared. but column has noname. (Type delcare only!)

Column Types for following

  • :i8: 1byte Integer (8bits)
  • :i16: 2byte Integer (16bits)
  • :i32 or :integer: 4byte Integer (32bits)
  • :string: String type (Any length usable)

Add new Record

Use for grow or grow! method. (grow method is alias for grow!)

for example

yellow_sweet = YellowSweet.new
yellow_sweet.grow!(30, 2000, 500000, "test")
p yellow_sweet[0]
=> [30, 2000, 500000, "test"]

Packing (Serialization)

Use for pack method.

yellow_sweet.pack
=> "\x1E\a\xD0\x00\a\xA1 test\x00"

returned serialized String.

Unpacking (Deserialization)

Use for unpack class method.

YellowSweet.unpack("\x1E\a\xD0\x00\a\xA1 test\x00")
 => #<Zeamays::Cob:0x007fdc0b538150 @rows=[[30, 2000, 500000, "test"]]>

returned deserialized model instance.

Persistation for File System

Use Zeamays::Fridge

saving

Zeamays::Fridge.stick('./tmp/yellow_sweet.db', yellow_sweet.freezed)

loading

serialized = Zeamays::Fridge.take('./tmp/yellow_sweet.db')
yellow_sweet = YellowSweet.defreeze(serialized)
 => #<Zeamays::Cob:0x007fdc0b538150 @rows=[[30, 2000, 500000, "test"]]>

Installation

Add this line to your application's Gemfile:

gem 'zeamays'

And then execute:

$ bundle

Or install it yourself as:

$ gem install zeamays

Contributing

  1. Fork it ( https://github.com/[my-github-username]/zeamays/fork )
  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 a new Pull Request