zeamays 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c2e4a80fc0fe7de57bf7f44e1509c5c47ec58bc2
4
- data.tar.gz: 6afdce580bfe2fac0ba159a21ba3153d9cb6f193
3
+ metadata.gz: 63c64b1abe873452b3a50f93df15acc7c37201e9
4
+ data.tar.gz: 31593cf69e4c7a3b281d890319752f5ca7dd1696
5
5
  SHA512:
6
- metadata.gz: 11a714a7c8de5a974a0de9de20087205ae9aa8df10150aef1c03c818bf58792a4ab81664bf9339e7d99b0a1201f3ebb659d07074c0db9282b4b2ede43223cef8
7
- data.tar.gz: 120723a5fc7f25f964cf1968eb988731520941b456c3f2abe4afe2db087ac0cabd18ccbffa125b93062058f17caeaa73b32aba028c8fe9940601acb9f0f8dd34
6
+ metadata.gz: 300eeb8608f053cfc6275ee0b944859fbbb0ceeb42fa26c217c69ae717a8964c475a1d566efb9380481b982d041fc0dba6ad231ce9a03a740031aa1d7b24d83b
7
+ data.tar.gz: 364538df09fae0b35285de80254e4b2ae50b85eb46ddd6a50e823e7587a37cbb52aa103e7c8b242cc3063d8446ea3baff7be33a17f7d052869cd564b61a0e8d6
@@ -4,3 +4,4 @@ rvm:
4
4
  - 2.0.0
5
5
  - 2.1.0
6
6
  - 2.1.2
7
+ cache: bundler
data/README.md CHANGED
@@ -23,7 +23,7 @@ Or install it yourself as:
23
23
  Declare Modeling for
24
24
 
25
25
  ```ruby
26
- class ExampleCobClass < Zeamays::Cob
26
+ class YellowSweet < Zeamays::Cob
27
27
  gene_sequencing :i8, :i16, :integer, :string
28
28
  end
29
29
  ```
@@ -44,10 +44,34 @@ Use for `grow` or `grow!` method(`grow` method is alias for `grow!`).
44
44
  for example
45
45
 
46
46
  ```ruby
47
- yellow_sweet = ExampleCobClass.new
47
+ yellow_sweet = YellowSweet.new
48
48
  yellow_sweet.grow 30, 2000, 500000, "test"
49
49
  ```
50
50
 
51
+ ## Packing (Serialization)
52
+
53
+ Use for `pack` method.
54
+
55
+ ```ruby
56
+ yellow_sweet.pack
57
+ ```
58
+
59
+ returned **serialized** String.
60
+
61
+ ## Unpacking (Deserialization)
62
+
63
+ Use for `unpack` **class method**.
64
+
65
+ ```ruby
66
+ YellowSweet.unpack(packed_string)
67
+ ```
68
+
69
+ returned **deserialized** values.
70
+
71
+ ## Persistation for File System
72
+
73
+ TODO
74
+
51
75
  ## Contributing
52
76
 
53
77
  1. Fork it ( https://github.com/[my-github-username]/zeamays/fork )
@@ -9,5 +9,9 @@ module Zeamays
9
9
  include Growth
10
10
  include Freezing
11
11
  extend Defreezing
12
+
13
+ def [](index)
14
+ @rows[index]
15
+ end
12
16
  end
13
17
  end
@@ -13,6 +13,14 @@ module Zeamays
13
13
  unpacked_list
14
14
  end
15
15
 
16
+ def defreeze(freezed)
17
+ cob = Cob.new
18
+ unpack(freezed).each do |row|
19
+ cob.grow!(row)
20
+ end
21
+ cob
22
+ end
23
+
16
24
  private
17
25
  def tail_pattern
18
26
  'a*'
@@ -7,6 +7,13 @@ module Zeamays
7
7
  }.join("")
8
8
  end
9
9
 
10
+ def freeze
11
+ pack
12
+ end
13
+ def freezed
14
+ pack
15
+ end
16
+
10
17
  module ClassMethods
11
18
  def package_pattern
12
19
  gene_sequence.map { |type|
@@ -1,3 +1,3 @@
1
1
  module Zeamays
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -2,10 +2,10 @@ require "zeamays"
2
2
 
3
3
  describe "Zeamays Model example" do
4
4
  let(:example_cob_class) {
5
- class ExampleCobClass < Zeamays::Cob
5
+ class YellowSweet < Zeamays::Cob
6
6
  gene_sequencing :i8, :i16, :integer, :string
7
7
  end
8
- ExampleCobClass
8
+ YellowSweet
9
9
  }
10
10
 
11
11
  let(:cob) { example_cob_class.new }
@@ -18,5 +18,12 @@ describe "Zeamays Model example" do
18
18
 
19
19
  let(:packaged) { cob.pack }
20
20
  let(:unpackaged) { example_cob_class.unpack(packaged) }
21
- it { unpackaged.should eq [record1, record2] }
21
+ it { expect(unpackaged).to eq [record1, record2] }
22
+
23
+ describe "#defreeze" do
24
+ let(:freezed) { cob.freezed }
25
+ let(:defreezed) { example_cob_class.defreeze(freezed) }
26
+ it { expect(defreezed[0]).to eq record1 }
27
+ it { expect(defreezed[1]).to eq record2 }
28
+ end
22
29
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zeamays
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - myun2