client_data 0.0.3 → 0.0.4

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: 12134c9f82801ea1621068779a4993b9c9af61a2
4
- data.tar.gz: 74514ab82f79227682c2caac5a6041d60e354ef2
3
+ metadata.gz: 7074dfc10a10c2d65cea097fb30b841a965ccad4
4
+ data.tar.gz: cb532832ec22432dae24b5bc2eb41bf482bd2797
5
5
  SHA512:
6
- metadata.gz: 3c2760c33177f8009430fa476941959785f23f4d8f3cafbf5227bbc69c8727ef16496543c632311a45361cabc5e014b8b901ed82ddfdb1adf6f50b098f78b8ec
7
- data.tar.gz: 90ca280342aaae16feb28a84cf4dbed333de3dea7f1b93d041a90e84e1db1f40852601ec84d079d26b6d6951f8c7b57484287919d5b35b54e9f1466389542520
6
+ metadata.gz: 3798648fed6ea6a73cd795b3bcd9c808cedbf4dbeceaaaf8336f150ed87e085be57f6daac6f5b85c7e883a5146710d07bd7dd8e06faff8a6fc0a325216af4db3
7
+ data.tar.gz: a26502b655d6605430bd7b5e6061607a8646a050fa4b037cc40d9d1299f97c075fbadf5c2320fdd28b6d753ade10949319035cae5ec5dafa96f2054c280dedef
@@ -2,7 +2,7 @@ module ClientData
2
2
  class Builder
3
3
  attr_accessor :controller
4
4
 
5
- def initialize(controller)
5
+ def initialize(controller = nil)
6
6
  @controller = controller
7
7
  end
8
8
  end
@@ -11,16 +11,14 @@ module ClientData
11
11
 
12
12
  module ClassMethods
13
13
  def client_data(*configs)
14
- self.__cs_builders ||= {}
15
- self.__cs_builders[self.name] ||= []
16
- self.__cs_builders[self.name].concat(configs)
14
+ self.__cs_builders ||= []
15
+ self.__cs_builders.concat(configs).uniq!
17
16
  end
18
17
  end
19
18
 
20
19
  module InstanceMethods
21
20
  def client_data_filter
22
- configs = get_config_keys(params[:controller])
23
- configs.each do |key|
21
+ config_keys.each do |key|
24
22
  begin
25
23
  klass = "#{builder_namespace}#{key.to_s.capitalize}Builder"
26
24
  klass = klass.constantize
@@ -51,10 +49,15 @@ module ClientData
51
49
  @provider ||= Adapters.factory(self)
52
50
  end
53
51
 
54
- private
55
-
56
- def get_config_keys(controller)
57
- self.class.__cs_builders.try(:[], "#{controller.capitalize}Controller") || []
52
+ def config_keys
53
+ @keys ||= begin
54
+ keys = []
55
+ klass = self.class
56
+ loop do
57
+ keys += klass.__cs_builders || [] if klass.respond_to?(:__cs_builders)
58
+ break keys unless klass.respond_to?(:superclass) && klass = klass.superclass
59
+ end
60
+ end
58
61
  end
59
62
  end
60
63
  end
@@ -1,3 +1,3 @@
1
1
  module ClientData
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: client_data
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stan Bondi