strongbox 0.4.6 → 0.4.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/strongbox.rb CHANGED
@@ -5,7 +5,7 @@ require 'strongbox/lock'
5
5
 
6
6
  module Strongbox
7
7
 
8
- VERSION = "0.4.6"
8
+ VERSION = "0.4.7"
9
9
 
10
10
  RSA_PKCS1_PADDING = OpenSSL::PKey::RSA::PKCS1_PADDING
11
11
  RSA_SSLV23_PADDING = OpenSSL::PKey::RSA::SSLV23_PADDING
@@ -26,6 +26,7 @@ module Strongbox
26
26
 
27
27
  def included base #:nodoc:
28
28
  base.extend ClassMethods
29
+ base.class_attribute :lock_options
29
30
  end
30
31
  end
31
32
 
@@ -45,12 +46,14 @@ module Strongbox
45
46
  def encrypt_with_public_key(name, options = {})
46
47
  include InstanceMethods
47
48
 
48
- class_inheritable_reader :lock_options
49
- write_inheritable_attribute(:lock_options, {}) if lock_options.nil?
50
-
49
+ if respond_to?(:class_attribute)
50
+ self.lock_options = {} if lock_options.nil?
51
+ else
52
+ class_inheritable_reader :lock_options
53
+ write_inheritable_attribute(:lock_options, {}) if lock_options.nil?
54
+ end
51
55
 
52
56
  lock_options[name] = options.symbolize_keys.reverse_merge Strongbox.options
53
-
54
57
  define_method name do
55
58
  lock_for(name)
56
59
  end
@@ -117,6 +117,10 @@ module Strongbox
117
117
  @size
118
118
  end
119
119
 
120
+ def length
121
+ @size
122
+ end
123
+
120
124
  def ensure_required_columns
121
125
  columns = [@name.to_s]
122
126
  columns += [@symmetric_key, @symmetric_iv] if @symmetric == :always
data/test/test_helper.rb CHANGED
@@ -50,6 +50,7 @@ def rebuild_class options = {}
50
50
  include Strongbox
51
51
  encrypt_with_public_key :secret, options
52
52
  end
53
+ Dummy.reset_column_information
53
54
  end
54
55
 
55
56
  def assert_has_errors_on(model,attribute)
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: strongbox
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
5
4
  prerelease:
6
- segments:
7
- - 0
8
- - 4
9
- - 6
10
- version: 0.4.6
5
+ version: 0.4.7
11
6
  platform: ruby
12
7
  authors:
13
8
  - Spike Ilacqua
@@ -15,7 +10,7 @@ autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
12
 
18
- date: 2011-03-18 00:00:00 -06:00
13
+ date: 2011-06-14 00:00:00 -06:00
19
14
  default_executable:
20
15
  dependencies:
21
16
  - !ruby/object:Gem::Dependency
@@ -26,9 +21,6 @@ dependencies:
26
21
  requirements:
27
22
  - - ">="
28
23
  - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
24
  version: "0"
33
25
  type: :runtime
34
26
  version_requirements: *id001
@@ -40,9 +32,6 @@ dependencies:
40
32
  requirements:
41
33
  - - ">="
42
34
  - !ruby/object:Gem::Version
43
- hash: 3
44
- segments:
45
- - 0
46
35
  version: "0"
47
36
  type: :development
48
37
  version_requirements: *id002
@@ -54,9 +43,6 @@ dependencies:
54
43
  requirements:
55
44
  - - ">="
56
45
  - !ruby/object:Gem::Version
57
- hash: 3
58
- segments:
59
- - 0
60
46
  version: "0"
61
47
  type: :development
62
48
  version_requirements: *id003
@@ -100,18 +86,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
100
86
  requirements:
101
87
  - - ">="
102
88
  - !ruby/object:Gem::Version
103
- hash: 3
104
- segments:
105
- - 0
106
89
  version: "0"
107
90
  required_rubygems_version: !ruby/object:Gem::Requirement
108
91
  none: false
109
92
  requirements:
110
93
  - - ">="
111
94
  - !ruby/object:Gem::Version
112
- hash: 3
113
- segments:
114
- - 0
115
95
  version: "0"
116
96
  requirements: []
117
97