phi_attrs 0.1.0 → 0.1.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 02627c096610024d700d1bc934ae30f39f64cbcc
4
- data.tar.gz: c8f2fa25466c2f1360033ed73dd7d28fb89f1d17
3
+ metadata.gz: 8f28f8b165404acd488de741070670268bb5e1a3
4
+ data.tar.gz: 8610013fc23d93100ba5829327a85c32516a2f38
5
5
  SHA512:
6
- metadata.gz: 117aea4893f55a9dd57d18efd3e0f4795add98e2654d83d7ffe44a452154824ed499d8b05de61d8083d7bf9af183a2a7036e88d1532822a38bfae895692356dc
7
- data.tar.gz: 543f080561a1d15412592ca91af1e8eb15040eb26c07c9a6e4d53758cfaa446becc96e7b1a5217288332625aca7e770a35ffda095cd86eaf8ba89050d3c612be
6
+ metadata.gz: 4b181df2aacce039f31c31a97051434f99a5dc96f975f2668eba97a7d7cff0a357f6aed8eca75a03a75945b1b4489083e489318e4ba680a446968b93d3142285
7
+ data.tar.gz: 1bfa9fac24405baa8a8e3e91eb8f5db4f7602413254143d9b8526d61f45f396250351bb333ca99da35a49a293d303521466974c79ffa0a83ecf9ce8e391463a7
data/.gitignore CHANGED
@@ -14,3 +14,4 @@
14
14
  /test/sample/tmp/
15
15
  *.sqlite3
16
16
  *.log
17
+ .rspec_status
@@ -7,8 +7,11 @@ module PhiAttrs
7
7
  included do
8
8
  class_attribute :__phi_exclude_methods
9
9
  class_attribute :__phi_include_methods
10
+ class_attribute :__phi_extended_methods
10
11
  class_attribute :__phi_methods_wrapped
11
12
 
13
+ after_initialize :wrap_phi
14
+
12
15
  self.__phi_methods_wrapped = []
13
16
  end
14
17
 
@@ -21,6 +24,10 @@ module PhiAttrs
21
24
  self.__phi_include_methods = methods.map(&:to_s)
22
25
  end
23
26
 
27
+ def extend_phi_access(*methods)
28
+ self.__phi_extended_methods = methods.map(&:to_s)
29
+ end
30
+
24
31
  def allow_phi!(user_id, reason)
25
32
  RequestStore.store[:phi_access] ||= {}
26
33
 
@@ -42,9 +49,7 @@ module PhiAttrs
42
49
  end
43
50
  end
44
51
 
45
- def initialize(*args)
46
- super(*args)
47
-
52
+ def wrap_phi
48
53
  # Disable PHI access by default
49
54
  @__phi_access_allowed = false
50
55
  @__phi_access_logged = false
@@ -3,7 +3,7 @@ require 'rails'
3
3
 
4
4
  module PhiAttrs
5
5
  class Railtie < Rails::Railtie
6
- initializer 'rolify.initialize' do
6
+ initializer 'phi_attrs.initialize' do
7
7
  ActiveSupport.on_load(:active_record) do
8
8
  ActiveRecord::Base.send :extend, PhiAttrs
9
9
  end
@@ -1,3 +1,3 @@
1
1
  module PhiAttrs
2
- VERSION = '0.1.0'.freeze
2
+ VERSION = '0.1.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phi_attrs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wyatt Kirby
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-07-04 00:00:00.000000000 Z
11
+ date: 2018-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -173,7 +173,6 @@ extra_rdoc_files: []
173
173
  files:
174
174
  - ".gitignore"
175
175
  - ".rspec"
176
- - ".rspec_status"
177
176
  - ".travis.yml"
178
177
  - Appraisals
179
178
  - Dockerfile
data/.rspec_status DELETED
@@ -1,14 +0,0 @@
1
- example_id | status | run_time |
2
- ------------------------------- | ------ | --------------- |
3
- ./spec/phi_attrs_spec.rb[1:1] | passed | 0.0012 seconds |
4
- ./spec/phi_attrs_spec.rb[1:2:1] | passed | 0.00702 seconds |
5
- ./spec/phi_attrs_spec.rb[1:2:2] | passed | 0.00064 seconds |
6
- ./spec/phi_attrs_spec.rb[1:2:3] | passed | 0.00054 seconds |
7
- ./spec/phi_attrs_spec.rb[1:3:1] | passed | 0.00642 seconds |
8
- ./spec/phi_attrs_spec.rb[1:3:2] | passed | 0.00121 seconds |
9
- ./spec/phi_attrs_spec.rb[1:4:1] | passed | 0.00085 seconds |
10
- ./spec/phi_attrs_spec.rb[1:4:2] | passed | 0.00075 seconds |
11
- ./spec/phi_attrs_spec.rb[1:4:3] | passed | 0.00086 seconds |
12
- ./spec/phi_attrs_spec.rb[1:5:1] | passed | 0.00068 seconds |
13
- ./spec/phi_attrs_spec.rb[1:5:2] | passed | 0.00444 seconds |
14
- ./spec/phi_attrs_spec.rb[1:5:3] | passed | 0.00091 seconds |