zeamays 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/lib/zeamays.rb +0 -1
- data/lib/zeamays/cob/defreezing.rb +4 -2
- data/lib/zeamays/cob/freezing.rb +2 -7
- data/lib/zeamays/fridge.rb +9 -3
- data/lib/zeamays/version.rb +1 -1
- data/spec/model_test/zeamays_mode_example_spec.rb +32 -12
- data/zeamays.gemspec +2 -2
- metadata +4 -19
- data/lib/zeamays/corn.rb +0 -4
- data/lib/zeamays/corn/fruiter.rb +0 -8
- data/lib/zeamays/corn/fruiter/byte.rb +0 -11
- data/lib/zeamays/corn/fruiter/integer16.rb +0 -11
- data/lib/zeamays/corn/fruiter/integer32.rb +0 -11
- data/lib/zeamays/corn/fruiter/string.rb +0 -22
- data/lib/zeamays/corn/granule.rb +0 -11
- data/lib/zeamays/corn/mass.rb +0 -11
- data/lib/zeamays/corn/string.rb +0 -11
- data/spec/zeamays/corn/fruiter/integer16_spec.rb +0 -13
- data/spec/zeamays/corn/fruiter/integer32_spec.rb +0 -13
- data/spec/zeamays/corn/fruiter_spec.rb +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a97403a14887bb25163d86332669c1b3d13c2af
|
4
|
+
data.tar.gz: 14d6996da00292657523488cc36d923ced25551b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 802cc378549b24299c768c331b413cfd7b5095d2d514d9875f5b4ac960fd99ab78022f7b1563f599e16fef7db2f909706b439d31aeb56fb161ca7625cd6b70b9
|
7
|
+
data.tar.gz: efedb9afb96a072416212ae8859d8d1ace8d7ddcba82cebe0b0a9353f3b2524bf726bc2d92a99a0248418e829397f7ff38322d4dc60d518d73939ead486647bf
|
data/README.md
CHANGED
@@ -2,7 +2,9 @@
|
|
2
2
|
|
3
3
|
[![Build Status](https://travis-ci.org/myun2ext/zeamays.svg?branch=master)](https://travis-ci.org/myun2ext/zeamays)
|
4
4
|
|
5
|
-
|
5
|
+
**Zeamays** is **Simple Persistation Any Data** for Ruby.
|
6
|
+
|
7
|
+
https://rubygems.org/gems/zeamays
|
6
8
|
|
7
9
|
## Installation
|
8
10
|
|
data/lib/zeamays.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Zeamays
|
2
2
|
class Cob
|
3
3
|
module Defreezing
|
4
|
-
def
|
4
|
+
def deserialized(packed_string)
|
5
5
|
unpacked_list = []
|
6
6
|
|
7
7
|
left_string = packed_string
|
@@ -15,11 +15,13 @@ module Zeamays
|
|
15
15
|
|
16
16
|
def defreeze(freezed)
|
17
17
|
cob = Cob.new
|
18
|
-
|
18
|
+
deserialized(freezed).each do |row|
|
19
19
|
cob.grow!(row)
|
20
20
|
end
|
21
21
|
cob
|
22
22
|
end
|
23
|
+
alias unpack defreeze
|
24
|
+
alias depack defreeze
|
23
25
|
|
24
26
|
private
|
25
27
|
def tail_pattern
|
data/lib/zeamays/cob/freezing.rb
CHANGED
data/lib/zeamays/fridge.rb
CHANGED
@@ -1,9 +1,15 @@
|
|
1
1
|
module Zeamays
|
2
2
|
class Fridge
|
3
|
-
def self.stick(
|
4
|
-
File.open(path, "wb") { |
|
5
|
-
f.write
|
3
|
+
def self.stick(path, freezed)
|
4
|
+
File.open(path, "wb") { |f|
|
5
|
+
f.write(freezed)
|
6
6
|
}
|
7
7
|
end
|
8
|
+
|
9
|
+
def self.take(path)
|
10
|
+
#File.open(path, "rb") { |f|
|
11
|
+
#}
|
12
|
+
readed = File.binread(path)
|
13
|
+
end
|
8
14
|
end
|
9
15
|
end
|
data/lib/zeamays/version.rb
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
require "zeamays"
|
2
2
|
|
3
3
|
describe "Zeamays Model example" do
|
4
|
-
|
4
|
+
before do
|
5
5
|
class YellowSweet < Zeamays::Cob
|
6
6
|
gene_sequencing :i8, :i16, :integer, :string
|
7
7
|
end
|
8
|
-
|
9
|
-
}
|
8
|
+
end
|
10
9
|
|
11
|
-
let(:cob) {
|
10
|
+
let(:cob) { YellowSweet.new }
|
12
11
|
let(:record1) { [30, 2000, 500000, "test"] }
|
13
12
|
let(:record2) { [80, 1000, 200000, "Example!!! "] }
|
14
13
|
before do
|
@@ -16,14 +15,35 @@ describe "Zeamays Model example" do
|
|
16
15
|
cob.grow(record2)
|
17
16
|
end
|
18
17
|
|
19
|
-
let(:
|
20
|
-
let(:
|
21
|
-
|
18
|
+
let(:packed) { cob.pack }
|
19
|
+
let(:unpacked) { YellowSweet.unpack(packed) }
|
20
|
+
|
21
|
+
describe "pack and unpack" do
|
22
|
+
it { expect(unpacked[0]).to eq record1 }
|
23
|
+
it { expect(unpacked[1]).to eq record2 }
|
24
|
+
end
|
25
|
+
|
26
|
+
describe "Fridging" do
|
27
|
+
before do
|
28
|
+
FileUtils.makedirs("./tmp")
|
29
|
+
fridging
|
30
|
+
end
|
31
|
+
after do
|
32
|
+
#FileUtils.remove_dir("./tmp")
|
33
|
+
end
|
34
|
+
|
35
|
+
let(:fridging_path) { "./tmp/yellow_sweet.zmd" }
|
36
|
+
let(:fridging) do
|
37
|
+
Zeamays::Fridge.stick(fridging_path, cob.freezed)
|
38
|
+
end
|
39
|
+
let(:defridged) do
|
40
|
+
Zeamays::Fridge.take(fridging_path)
|
41
|
+
end
|
42
|
+
let(:defreezed_cob) do
|
43
|
+
YellowSweet.defreeze(defridged)
|
44
|
+
end
|
22
45
|
|
23
|
-
|
24
|
-
|
25
|
-
let(:defreezed) { example_cob_class.defreeze(freezed) }
|
26
|
-
it { expect(defreezed[0]).to eq record1 }
|
27
|
-
it { expect(defreezed[1]).to eq record2 }
|
46
|
+
it { expect(defreezed_cob[0]).to eq record1 }
|
47
|
+
it { expect(defreezed_cob[1]).to eq record2 }
|
28
48
|
end
|
29
49
|
end
|
data/zeamays.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = Zeamays::VERSION
|
9
9
|
spec.authors = ["myun2"]
|
10
10
|
spec.email = ["myun2@nwhite.info"]
|
11
|
-
spec.summary = %q{
|
12
|
-
spec.description = %q{
|
11
|
+
spec.summary = %q{Simple Persistation Any Data for Ruby.}
|
12
|
+
spec.description = %q{Simple Persistation Any Data for Ruby.}
|
13
13
|
spec.homepage = "https://github.com/myun2ext/zeamays"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zeamays
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- myun2
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,7 +52,7 @@ dependencies:
|
|
52
52
|
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
description:
|
55
|
+
description: Simple Persistation Any Data for Ruby.
|
56
56
|
email:
|
57
57
|
- myun2@nwhite.info
|
58
58
|
executables: []
|
@@ -72,21 +72,9 @@ files:
|
|
72
72
|
- lib/zeamays/cob/freezing.rb
|
73
73
|
- lib/zeamays/cob/gene.rb
|
74
74
|
- lib/zeamays/cob/growth.rb
|
75
|
-
- lib/zeamays/corn.rb
|
76
|
-
- lib/zeamays/corn/fruiter.rb
|
77
|
-
- lib/zeamays/corn/fruiter/byte.rb
|
78
|
-
- lib/zeamays/corn/fruiter/integer16.rb
|
79
|
-
- lib/zeamays/corn/fruiter/integer32.rb
|
80
|
-
- lib/zeamays/corn/fruiter/string.rb
|
81
|
-
- lib/zeamays/corn/granule.rb
|
82
|
-
- lib/zeamays/corn/mass.rb
|
83
|
-
- lib/zeamays/corn/string.rb
|
84
75
|
- lib/zeamays/fridge.rb
|
85
76
|
- lib/zeamays/version.rb
|
86
77
|
- spec/model_test/zeamays_mode_example_spec.rb
|
87
|
-
- spec/zeamays/corn/fruiter/integer16_spec.rb
|
88
|
-
- spec/zeamays/corn/fruiter/integer32_spec.rb
|
89
|
-
- spec/zeamays/corn/fruiter_spec.rb
|
90
78
|
- spec/zeamays_spec.rb
|
91
79
|
- zeamays.gemspec
|
92
80
|
homepage: https://github.com/myun2ext/zeamays
|
@@ -112,10 +100,7 @@ rubyforge_project:
|
|
112
100
|
rubygems_version: 2.1.11
|
113
101
|
signing_key:
|
114
102
|
specification_version: 4
|
115
|
-
summary:
|
103
|
+
summary: Simple Persistation Any Data for Ruby.
|
116
104
|
test_files:
|
117
105
|
- spec/model_test/zeamays_mode_example_spec.rb
|
118
|
-
- spec/zeamays/corn/fruiter/integer16_spec.rb
|
119
|
-
- spec/zeamays/corn/fruiter/integer32_spec.rb
|
120
|
-
- spec/zeamays/corn/fruiter_spec.rb
|
121
106
|
- spec/zeamays_spec.rb
|
data/lib/zeamays/corn.rb
DELETED
data/lib/zeamays/corn/fruiter.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
module Zeamays
|
2
|
-
class Corn
|
3
|
-
class Fruiter
|
4
|
-
module String
|
5
|
-
def self.fruit_short_string(s)
|
6
|
-
bytesize = s.bytesize
|
7
|
-
[bytesize].pack("C") + s
|
8
|
-
end
|
9
|
-
|
10
|
-
def self.fruit_medium_string(s)
|
11
|
-
bytesize = s.bytesize
|
12
|
-
[bytesize].pack("n") + s
|
13
|
-
end
|
14
|
-
|
15
|
-
def self.fruit_large_string(s)
|
16
|
-
bytesize = s.bytesize
|
17
|
-
[bytesize].pack("N") + s
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
data/lib/zeamays/corn/granule.rb
DELETED
data/lib/zeamays/corn/mass.rb
DELETED
data/lib/zeamays/corn/string.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
require 'zeamays/corn/fruiter/integer16'
|
2
|
-
|
3
|
-
describe Zeamays::Corn::Fruiter::Integer16 do
|
4
|
-
let(:packing) { Zeamays::Corn::Fruiter::Integer16.fruit_i16(target_value) }
|
5
|
-
|
6
|
-
context "normally" do
|
7
|
-
let(:target_value) { 50000 }
|
8
|
-
subject { packing.unpack("n").first }
|
9
|
-
it { should eq target_value }
|
10
|
-
end
|
11
|
-
|
12
|
-
pending "Not Integer16 type"
|
13
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
require 'zeamays/corn/fruiter/integer32'
|
2
|
-
|
3
|
-
describe Zeamays::Corn::Fruiter::Integer32 do
|
4
|
-
let(:packing) { Zeamays::Corn::Fruiter::Integer32.fruit_i32(target_value) }
|
5
|
-
|
6
|
-
context "normally" do
|
7
|
-
let(:target_value) { 4000000000 }
|
8
|
-
subject { packing.unpack("N").first }
|
9
|
-
it { should eq target_value }
|
10
|
-
end
|
11
|
-
|
12
|
-
pending "Not Integer32 type"
|
13
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
require 'zeamays/corn/fruiter'
|
2
|
-
require 'zeamays/corn/fruiter/byte'
|
3
|
-
|
4
|
-
describe Zeamays::Corn::Fruiter do
|
5
|
-
context "Byte" do
|
6
|
-
let(:packing) { Zeamays::Corn::Fruiter::Byte.fruit_byte(target_value) }
|
7
|
-
|
8
|
-
context "normally" do
|
9
|
-
let(:target_value) { 30 }
|
10
|
-
subject { packing.unpack("C").first }
|
11
|
-
it { should eq target_value }
|
12
|
-
end
|
13
|
-
|
14
|
-
context "over byte size" do
|
15
|
-
let(:target_value) { 300 }
|
16
|
-
subject { packing.unpack("C").first }
|
17
|
-
it { should eq (300 - 256) }
|
18
|
-
end
|
19
|
-
|
20
|
-
pending "Not byte type"
|
21
|
-
end
|
22
|
-
end
|