storext 0.2.1 → 1.0.0

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: 4305f2288cae4be148bd2894bec0179e6f133d1d
4
- data.tar.gz: b3bb3521ad5ed2d442dadf58e6c82bd8948a5c49
3
+ metadata.gz: 41501e45ad81d0210775629539268c73a96d98a0
4
+ data.tar.gz: e775e1155ae76dda7b5098920a366b74fe794724
5
5
  SHA512:
6
- metadata.gz: 6b92816e609332686a166e1f0477eb2d341edfb9c08a624661abc9eb4ddbe01fb184ced48911d10246b574446b04ff129168d5d6282baff9c6ea177c5adea878
7
- data.tar.gz: a50ae3d082e6ada9f2a610b647899d9f53babbf4ad233c180b3fb620cc9e7c22845f4f1d90d7a8ba276aebc9e6231b7f80d71229b9abc59b673bb6d0867ecbcf
6
+ metadata.gz: 64f397db35f2cde3086cc7a8b6102c818fd83a8dedb712b1d6e401609a3f4201cf9b28a30725eed0665d8531f49778b8f12cb96382b2dc47e6f2ed6475b3b4aa
7
+ data.tar.gz: fbce44911c14449ca9a2015bd0107180fb0d76aea197c48e9ef33836a1b06e740899d2c5c882a2d3e18c84a5ce4952debf28a257eec4f843270ef492bf969d1e
data/lib/storext.rb CHANGED
@@ -33,8 +33,8 @@ module Storext
33
33
  self.storext_options = {}
34
34
  end
35
35
 
36
- class_attribute :store_attribute_defs
37
- self.store_attribute_defs = {}
36
+ class_attribute :storext_definitions
37
+ self.storext_definitions = {}
38
38
 
39
39
  unless defined?(self::Boolean)
40
40
  self::Boolean = ::Axiom::Types::Boolean
@@ -42,16 +42,16 @@ module Storext
42
42
 
43
43
  def storext_attrs_for(column)
44
44
  attrs = []
45
- store_attribute_defs.each do |attr, definition|
45
+ storext_definitions.each do |attr, definition|
46
46
  attrs << attr if definition[:column] == column
47
47
  end
48
48
  attrs
49
49
  end
50
50
 
51
51
  def track_store_attribute(column, attr, type, opts)
52
- self.store_attribute_defs = self.store_attribute_defs.dup
52
+ self.storext_definitions = self.storext_definitions.dup
53
53
 
54
- store_attribute_defs[attr] = {
54
+ storext_definitions[attr] = {
55
55
  column: column,
56
56
  type: type,
57
57
  opts: opts,
@@ -1,6 +1,18 @@
1
1
  module Storext
2
2
  module InstanceMethods
3
3
 
4
+ def destroy_key(column, attr)
5
+ new_value = send(column)
6
+ new_value.delete(attr.to_s)
7
+ send("#{column}=", new_value)
8
+ end
9
+
10
+ def destroy_keys(column, *attrs)
11
+ new_value = send(column)
12
+ attrs.each { |a| new_value.delete(a.to_s) }
13
+ send("#{column}=", new_value)
14
+ end
15
+
4
16
  private
5
17
 
6
18
  def set_storext_defaults
@@ -8,7 +20,7 @@ module Storext
8
20
  self.send("#{column}=", default) if self.send(column).nil?
9
21
  end
10
22
 
11
- store_attribute_defs.each do |attr, definition|
23
+ storext_definitions.each do |attr, definition|
12
24
  set_storext_default_for(definition[:column], attr)
13
25
  end
14
26
  end
@@ -35,8 +47,8 @@ module Storext
35
47
 
36
48
  klass.attribute(
37
49
  "casted_attr",
38
- self.class.store_attribute_defs[attr][:type],
39
- self.class.store_attribute_defs[attr][:opts],
50
+ self.class.storext_definitions[attr][:type],
51
+ self.class.storext_definitions[attr][:opts],
40
52
  )
41
53
 
42
54
  @storext_cast_proxies[attr] = klass.new
@@ -1,3 +1,3 @@
1
1
  module Storext
2
- VERSION = "0.2.1"
2
+ VERSION = "1.0.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: storext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - G5
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-01-30 00:00:00.000000000 Z
13
+ date: 2015-03-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails