shameless 0.5.1 → 0.5.2

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: e42bbb56cdf62849cbe20e72336e4dbafa8f88c7
4
- data.tar.gz: 5e183268e8aec40081c4f27bb63ddb7fa3e871e4
3
+ metadata.gz: ada388329571a9d4e7401b2258bd315cd92f9219
4
+ data.tar.gz: d12bbf07ca0ede9db4f4ea79b21048b0eeeab4b7
5
5
  SHA512:
6
- metadata.gz: da822d4737743bdf66ffe9c9d3e19cdc8572b73168d28bef2c6cba2270f356cb2d7ed8b949b39de7491b7248587a4d832c8f175a425a0684b2fb7854a2d07224
7
- data.tar.gz: db5bfe0bbf1d1e2ae07c9a720a15aa23cf12dd546d924bdc2f57adddcf60be266a77b243916d679301aa5bcbc1c95da22ae916a5aade5dd95d690a4e69c98836
6
+ metadata.gz: df9d74db8abe98a8b5437511a35af4e159ae224d6db17e8fe3870acf12311a9bd407221248ca2a081c866b49da903283b37f8f423c6dc62ad11643cb924c006f
7
+ data.tar.gz: '0638d93b2c824cf7c4fa39b8454ec13ef8ae667f159a6ed8fe691b441334c6731c34f57022ce7a1d9297834ebae02b985897914a7e6ea57e4293212b668c2997'
@@ -1,5 +1,9 @@
1
1
  ### Unreleased
2
2
 
3
+ ### 0.5.2 (2016-12-02)
4
+
5
+ * Eagerly initialize `Model#cells`
6
+
3
7
  ### 0.5.1 (2016-12-01)
4
8
 
5
9
  * Convert shardable value to integer for index tables
@@ -8,6 +8,8 @@ module Shameless
8
8
  def attach_to(store, name)
9
9
  @store = store
10
10
  @name = name || self.name.downcase # TODO use activesupport?
11
+ @cell_names = []
12
+ cell(Cell::BASE)
11
13
 
12
14
  include(InstanceMethods)
13
15
  end
@@ -22,10 +24,16 @@ module Shameless
22
24
 
23
25
  def cell(name)
24
26
  name = name.to_s
27
+ @cell_names << name
25
28
 
26
- define_method(name) do
27
- @cells[name] ||= Cell.new(self, name)
28
- end
29
+ define_method(name) { @cells[name] }
30
+ end
31
+
32
+ def initialize_cells(instance, base_body)
33
+ Hash[@cell_names.map do |name|
34
+ cell = name == Cell::BASE ? Cell.base(instance, base_body) : Cell.new(instance, name)
35
+ [name, cell]
36
+ end]
29
37
  end
30
38
 
31
39
  def put(values)
@@ -109,11 +117,7 @@ module Shameless
109
117
 
110
118
  def initialize(uuid, base_body = nil)
111
119
  @uuid = uuid
112
- @cells = {Cell::BASE => Cell.base(self, base_body)}
113
- end
114
-
115
- def base
116
- @cells[Cell::BASE]
120
+ @cells = self.class.initialize_cells(self, base_body)
117
121
  end
118
122
 
119
123
  def [](field)
@@ -1,3 +1,3 @@
1
1
  module Shameless
2
- VERSION = "0.5.1"
2
+ VERSION = "0.5.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shameless
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Olek Janiszewski
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-12-01 00:00:00.000000000 Z
11
+ date: 2016-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack