client_data 0.1.4 → 0.1.5

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: c245062191f8238376bdfe2b2b72a28d6861d5d6
4
- data.tar.gz: 8e24ebc0bf1ebe435d1bb06d40d1ff801525c235
3
+ metadata.gz: b6e3911baafa6ddf8650808607f0f55dbf359c7a
4
+ data.tar.gz: 3e79c97a3a4f070acec57c85e22ce917e8f33f71
5
5
  SHA512:
6
- metadata.gz: 84f29faffb8b62bf0be5497279d16ed3696a1ca9f2a5688cd40b56afa0d1e50c50e570197fd85f7ca03030feb3206080f8fb2da9320a729caa7500d1f453daaa
7
- data.tar.gz: 4fe73f3f63267fe96af8bdaa0605389638005005788ec30d723a9952dbc764e872814cb95e85e60d9fae0e6c55fe908b051db4ddd16bf756361c2643dd8c931e
6
+ metadata.gz: 8eda8ca31f669307e3ce36c25f003d6c3b33a0026b5000f60dc8db63b57495d716c2fc3363ee85b42c4186cecd9f18f4d24ea7577536156eef1cbcb815c93d83
7
+ data.tar.gz: cf2c196dc8282f07ff6e4aa9787ce92f934340c79f79664ca549641ab109cbd293c106ec5ce27de4425aea7737fd74029b6f48b256da3d2531eff80849a53d62
@@ -1,9 +1,11 @@
1
1
  module ClientData
2
2
  class Builder
3
3
  attr_accessor :controller
4
+ attr_reader :options
4
5
 
5
- def initialize(controller = nil)
6
+ def initialize(controller = nil, options = {})
6
7
  @controller = controller
8
+ @options = options
7
9
  end
8
10
 
9
11
  def self.properties(*props)
@@ -21,6 +23,10 @@ module ClientData
21
23
  end
22
24
  end
23
25
  end
26
+
27
+ def self.builder_name
28
+ self.name.split('::').last.chomp('Builder').underscore
29
+ end
24
30
  end
25
31
  end
26
32
 
@@ -21,6 +21,11 @@ module ClientData
21
21
  end
22
22
  end
23
23
 
24
+ def client_data_options(builder_name, options)
25
+ builder_options_hash[builder_name.to_sym] ||= {}
26
+ builder_options_hash[builder_name.to_sym].merge!(options)
27
+ end
28
+
24
29
  def builders
25
30
  @builders ||= begin
26
31
  builders_hash = {}
@@ -82,7 +87,8 @@ module ClientData
82
87
  "Error: #{e.message}"
83
88
  end
84
89
 
85
- klass.new.tap { |o| o.controller = self }
90
+ options = builder_options_hash[klass.builder_name.to_sym].dup || {}
91
+ klass.new(self, options).tap { |o| o.controller = self }
86
92
  end
87
93
 
88
94
  def builder_namespace
@@ -1,3 +1,3 @@
1
1
  module ClientData
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: client_data
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stan Bondi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-01 00:00:00.000000000 Z
11
+ date: 2014-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport