lux-fw 0.1.35 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. checksums.yaml +5 -5
  2. data/.version +1 -1
  3. data/bin/cli/am +67 -41
  4. data/bin/cli/assets +1 -1
  5. data/bin/cli/console +3 -2
  6. data/bin/cli/eval +11 -2
  7. data/bin/cli/exceptions +1 -1
  8. data/bin/cli/generate +4 -0
  9. data/bin/cli/render +18 -0
  10. data/bin/cli/routes +3 -1
  11. data/bin/cli/server +4 -1
  12. data/bin/lux +10 -1
  13. data/bin/txt/nginx.conf +35 -18
  14. data/lib/common/class_attributes.rb +10 -10
  15. data/lib/common/{before_and_after.rb → class_callbacks.rb} +12 -21
  16. data/lib/common/crypt.rb +10 -6
  17. data/lib/common/dynamic_class.rb +12 -7
  18. data/lib/common/generic_model.rb +6 -6
  19. data/lib/common/hash_with_indifferent_access.rb +6 -284
  20. data/lib/{lux/helper/lib/html_tag.rb → common/html_tag_builder.rb} +1 -1
  21. data/lib/common/policy.rb +2 -2
  22. data/lib/common/url.rb +6 -4
  23. data/lib/lux-fw.rb +2 -13
  24. data/lib/lux/api/api.rb +34 -47
  25. data/lib/lux/api/lib/dsl.rb +2 -2
  26. data/lib/lux/api/lib/model_api.rb +40 -23
  27. data/lib/lux/api/lib/response.rb +30 -5
  28. data/lib/lux/application/application.rb +182 -0
  29. data/lib/lux/{controller → application}/lib/nav.rb +18 -21
  30. data/lib/lux/application/lib/plugs.rb +10 -0
  31. data/lib/lux/application/lib/render.rb +58 -0
  32. data/lib/lux/application/lib/route_test.rb +64 -0
  33. data/lib/lux/cache/cache.rb +27 -16
  34. data/lib/lux/cell/cell.rb +66 -54
  35. data/lib/lux/config/config.rb +51 -27
  36. data/lib/lux/current/current.rb +122 -0
  37. data/lib/lux/{page → current}/lib/encrypt_params.rb +2 -2
  38. data/lib/lux/{page → current}/lib/static_file.rb +29 -25
  39. data/lib/lux/delayed_job/delayed_job.rb +4 -4
  40. data/lib/lux/error/error.rb +31 -16
  41. data/lib/lux/helper/helper.rb +32 -37
  42. data/lib/lux/helper/helpers/application_helper.rb +3 -0
  43. data/lib/lux/helper/helpers/html_helper.rb +3 -0
  44. data/lib/lux/helper/helpers/mailer_helper.rb +11 -0
  45. data/lib/lux/lux.rb +40 -30
  46. data/lib/lux/mailer/mailer.rb +46 -29
  47. data/lib/lux/{page → response}/lib/flash.rb +1 -1
  48. data/lib/lux/response/lib/header.rb +21 -0
  49. data/lib/lux/response/response.rb +237 -0
  50. data/lib/lux/template/template.rb +20 -18
  51. data/lib/overload/array.rb +5 -0
  52. data/lib/overload/auto_loader.rb +27 -0
  53. data/lib/overload/blank.rb +8 -2
  54. data/lib/overload/float.rb +10 -0
  55. data/lib/overload/hash.rb +5 -12
  56. data/lib/overload/integer.rb +1 -5
  57. data/lib/overload/nil.rb +5 -0
  58. data/lib/overload/object.rb +1 -0
  59. data/lib/overload/r.rb +5 -0
  60. data/lib/overload/string.rb +4 -5
  61. data/lib/overload/{date.rb → time.rb} +23 -3
  62. metadata +37 -73
  63. data/bin/forever +0 -65
  64. data/bin/job_que +0 -39
  65. data/lib/lux/api/lib/application_api.rb +0 -38
  66. data/lib/lux/api/lib/doc_builder.rb +0 -19
  67. data/lib/lux/api/lib/rescue.rb +0 -8
  68. data/lib/lux/controller/controller.rb +0 -185
  69. data/lib/lux/controller/lib/plugs.rb +0 -10
  70. data/lib/lux/html/html.rb +0 -3
  71. data/lib/lux/html/lib/form.rb +0 -81
  72. data/lib/lux/html/lib/input.rb +0 -71
  73. data/lib/lux/html/lib/input_types.rb +0 -287
  74. data/lib/lux/lib/lux.rb +0 -51
  75. data/lib/lux/page/lib/response.rb +0 -178
  76. data/lib/lux/page/page.rb +0 -292
  77. data/lib/lux/rescue_from/rescue_from.rb +0 -63
  78. data/lib/plugins/assets/assets_plug.rb +0 -31
  79. data/lib/plugins/assets/helper_module_adapter.rb +0 -51
  80. data/lib/plugins/assets/init.rb +0 -4
  81. data/lib/plugins/db_helpers/array_and_hstore.rb +0 -64
  82. data/lib/plugins/db_helpers/arrays_and_tags.rb +0 -23
  83. data/lib/plugins/db_helpers/before_save.rb +0 -44
  84. data/lib/plugins/db_helpers/cached_find_by.rb +0 -45
  85. data/lib/plugins/db_helpers/class_and_instance.rb +0 -120
  86. data/lib/plugins/db_helpers/dataset_plugin.rb +0 -101
  87. data/lib/plugins/db_helpers/filter_wrappers.rb +0 -21
  88. data/lib/plugins/db_helpers/link_plugin.rb +0 -95
  89. data/lib/plugins/db_helpers/localize_plugin.rb +0 -57
  90. data/lib/plugins/db_helpers/primary_keys.rb +0 -36
  91. data/lib/plugins/db_helpers/typero_attributes.rb +0 -69
  92. data/lib/plugins/db_logger/init.rb +0 -18
  93. data/lib/plugins/db_logger/lux_response_adapter.rb +0 -9
  94. data/lib/plugins/paginate/helper.rb +0 -32
  95. data/lib/plugins/paginate/sequel_adapter.rb +0 -18
  96. data/lib/vendor/mini_assets/lib/asset.rb +0 -71
  97. data/lib/vendor/mini_assets/lib/asset/css.rb +0 -19
  98. data/lib/vendor/mini_assets/lib/asset/js.rb +0 -17
  99. data/lib/vendor/mini_assets/lib/base.rb +0 -69
  100. data/lib/vendor/mini_assets/lib/base/javascript.rb +0 -13
  101. data/lib/vendor/mini_assets/lib/base/stylesheet.rb +0 -5
  102. data/lib/vendor/mini_assets/lib/manifest.rb +0 -18
  103. data/lib/vendor/mini_assets/lib/opts.rb +0 -16
  104. data/lib/vendor/mini_assets/mini_assets.rb +0 -74
  105. data/lib/vendor/oauth/lib/facebook.rb +0 -35
  106. data/lib/vendor/oauth/lib/github.rb +0 -37
  107. data/lib/vendor/oauth/lib/google.rb +0 -41
  108. data/lib/vendor/oauth/lib/linkedin.rb +0 -41
  109. data/lib/vendor/oauth/lib/stackexchange.rb +0 -37
  110. data/lib/vendor/oauth/lib/twitter.rb +0 -41
  111. data/lib/vendor/oauth/oauth.rb +0 -46
@@ -1,35 +1,26 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # in some class
4
- # def self.before(proc=nil, &block)
5
- # BeforeAndAfter.add(self, caller[0], :before, proc || block)
6
- # end
7
- # or
8
- # BeforeAndAfter.define self, :before, :after
4
+ # ClassCallbacks.define self, :before, :after
9
5
  #
10
6
  # then to execute
11
7
  # instance_object = SomeClass.new
12
- # BeforeAndAfter.execute(instance_object, :before)
13
- # or
8
+ # ClassCallbacks.execute(instance_object, :before)
9
+ #
14
10
  # before do
15
11
  # ...
16
12
  # end
17
- # or
18
- # def before
19
- # super
20
- # ...
21
- # end
22
13
  #
23
14
  # logic is very simple, keep all pointers to all blocks in one class, resolve and execute as needed
24
15
  # we keep methods and ponters in different hashes to allow hot reload while development
25
16
 
26
- module BeforeAndAfter
17
+ module ClassCallbacks
27
18
  extend self
28
19
 
29
20
  @@methods = {}
30
21
  @@pointers = {}
31
22
 
32
- def add(klass, unique_id, action, method)
23
+ def add klass, unique_id, action, method
33
24
  key = Crypt.md5(unique_id)
34
25
  @@pointers[key] = method
35
26
  @@methods[klass.to_s] ||= {}
@@ -37,8 +28,8 @@ module BeforeAndAfter
37
28
  @@methods[klass.to_s][action].push(key) unless @@methods[klass.to_s][action].index(key)
38
29
  end
39
30
 
40
- def execute(instance_object, action)
41
- instance_object.send(action)
31
+ def execute instance_object, action, object=nil
32
+ object ? instance_object.send(action, object) : instance_object.send(action)
42
33
 
43
34
  # execute for self and parent
44
35
  for name in instance_object.class.ancestors.reverse.map(&:to_s)
@@ -47,9 +38,9 @@ module BeforeAndAfter
47
38
  if @@methods[name] && @@methods[name][action]
48
39
  for el in @@methods[name][action].map { |o| @@pointers[o] }
49
40
  if el.kind_of?(Symbol)
50
- instance_object.send(el)
41
+ object ? instance_object.send(el, object) : instance_object.send(el)
51
42
  else
52
- instance_object.instance_exec &el
43
+ object ? instance_object.instance_exec(object, &el) : instance_object.instance_exec(&el)
53
44
  end
54
45
  end
55
46
  end
@@ -59,11 +50,11 @@ module BeforeAndAfter
59
50
  def define(klass, *args)
60
51
  for action in args
61
52
  klass.class_eval %[
62
- def #{action}
53
+ def #{action}(duck=nil)
63
54
  end
64
55
 
65
- def self.#{action}(proc=nil, opts={}, &block)
66
- BeforeAndAfter.add(self, caller[0], :#{action}, proc || block)
56
+ def self.#{action}(proc=nil, &block)
57
+ ClassCallbacks.add(self, caller[0], :#{action}, proc || block)
67
58
  end
68
59
  ]
69
60
  end
data/lib/common/crypt.rb CHANGED
@@ -15,10 +15,10 @@ module Crypt
15
15
  ALGORITHM = 'HS512'
16
16
 
17
17
  def secret
18
- Lux.env('SECRET')
18
+ ENV.fetch('SECRET') { puts '* Warn: ENV SECRET not set'; 'foo' }
19
19
  end
20
20
 
21
- def base64(str)
21
+ def base64 str
22
22
  Base64.urlsafe_encode64(str)
23
23
  end
24
24
 
@@ -26,16 +26,20 @@ module Crypt
26
26
  SecureRandom.hex
27
27
  end
28
28
 
29
- def sha1(str)
29
+ def sha1 str
30
30
  Digest::SHA1.hexdigest(str.to_s + secret)
31
31
  end
32
32
 
33
- def md5(str)
33
+ def md5 str
34
34
  Digest::MD5.hexdigest(str.to_s + secret)
35
35
  end
36
36
 
37
- def bc(str)
38
- BCrypt::Password.create(str + secret)
37
+ def bcrypt plain, check=nil
38
+ if check
39
+ BCrypt::Password.new(check) == [plain, secret].join('')
40
+ else
41
+ BCrypt::Password.create(plain + secret)
42
+ end
39
43
  end
40
44
 
41
45
  # Crypt.encrypt('secret')
@@ -1,23 +1,28 @@
1
- # o = DynamicClass.new a: 'b'
2
- # o.a -> 'b'
3
- # o.b -> raises error
1
+ # o = DynamicClass.new name: 'a'
2
+ # o.name -> 'a'
3
+ # o.name = 'b'
4
+ # o.name 'b'
5
+ # o.name -> 'b'
6
+ # o.name = nil
7
+ # o.name -> nil
8
+ # o.title -> raises error
4
9
  class DynamicClass
5
10
  def initialize data, &block
6
11
  @data = data
7
12
  @block = block if block
8
13
  end
9
14
 
10
- def method_missing m, *args, &block
15
+ def method_missing m, arg=:_UNDEF
11
16
  key = m.to_s.sub('=','').to_sym
12
17
 
13
18
  unless @data.has_key?(key)
14
19
  raise ArgumentError.new('Key :%s not found in DynamicOptions' % key)
15
20
  end
16
21
 
17
- if m.to_s.include?('=')
18
- @data[key] = args[0]
19
- else
22
+ if arg == :_UNDEF
20
23
  @data[key]
24
+ else
25
+ @data[key] = arg
21
26
  end
22
27
  end
23
28
  end
@@ -20,12 +20,12 @@ class GenericModel
20
20
  @@values = {}
21
21
 
22
22
  class << self
23
- def values(vals)
23
+ def values vals
24
24
  @@values[self.to_s] = []
25
25
  vals.map { |el| add_value(el) }
26
26
  end
27
27
 
28
- def add_value(val)
28
+ def add_value val
29
29
  o = new(val)
30
30
  for key in val.keys
31
31
  eval %[def o.#{key}; @_vals[:#{key}]; end]
@@ -33,7 +33,7 @@ class GenericModel
33
33
  @@values[self.to_s].push(o)
34
34
  end
35
35
 
36
- def find(id)
36
+ def find id
37
37
  for el in all
38
38
  return el if el.id == id
39
39
  end
@@ -44,18 +44,18 @@ class GenericModel
44
44
  @@values[self.to_s]
45
45
  end
46
46
 
47
- def where(opts)
47
+ def where opts
48
48
  @@values[self.to_s].select{ |el| el[opts.keys[0]] == opts.values[0] }
49
49
  end
50
50
  end
51
51
 
52
52
  ###
53
53
 
54
- def initialize(vals)
54
+ def initialize vals
55
55
  @_vals = vals
56
56
  end
57
57
 
58
- def [](key)
58
+ def [] key
59
59
  @_vals[key]
60
60
  end
61
61
 
@@ -44,10 +44,15 @@ class HashWithIndifferentAccess
44
44
  end
45
45
 
46
46
  def dig *args
47
- list = args.map{ |_| _.class == Symbol ? _.to_s : _ }
47
+ list = args.map{ |it| it.class == Symbol ? it.to_s : it }
48
48
  @data.dig *list
49
49
  end
50
50
 
51
+ def pluck *args
52
+ args = args.map(&:to_s)
53
+ @data.select { |k,v| args.include?(k) }
54
+ end
55
+
51
56
  def clear
52
57
  @data.keys.each { |key| @data.delete(key) }
53
58
  end
@@ -67,286 +72,3 @@ class HashWithIndifferentAccess
67
72
  value.is_a?(Hash) ? self.class.new(value) : value
68
73
  end
69
74
  end
70
-
71
-
72
- # exrtacted from Rails
73
- # class HashWithIndifferentAccess < Hash
74
- # # Returns +true+ so that <tt>Array#extract_options!</tt> finds members of
75
- # # this class.
76
- # def extractable_options?
77
- # true
78
- # end
79
-
80
- # def with_indifferent_access
81
- # dup
82
- # end
83
-
84
- # def initialize(constructor = {})
85
- # if constructor.respond_to?(:to_hash)
86
- # super()
87
- # update(constructor)
88
-
89
- # hash = constructor.to_hash
90
- # self.default = hash.default if hash.default
91
- # self.default_proc = hash.default_proc if hash.default_proc
92
- # else
93
- # super(constructor)
94
- # end
95
- # end
96
-
97
- # def default(*args)
98
- # arg_key = args.first
99
-
100
- # if include?(key = convert_key(arg_key))
101
- # self[key]
102
- # else
103
- # super
104
- # end
105
- # end
106
-
107
- # def self.[](*args)
108
- # new.merge!(Hash[*args])
109
- # end
110
-
111
- # alias_method :regular_writer, :[]= unless method_defined?(:regular_writer)
112
- # alias_method :regular_update, :update unless method_defined?(:regular_update)
113
-
114
- # # Assigns a new value to the hash:
115
- # #
116
- # # hash = ActiveSupport::HashWithIndifferentAccess.new
117
- # # hash[:key] = 'value'
118
- # #
119
- # # This value can be later fetched using either +:key+ or <tt>'key'</tt>.
120
- # def []=(key, value)
121
- # regular_writer(convert_key(key), convert_value(value, for: :assignment))
122
- # end
123
-
124
- # alias_method :store, :[]=
125
-
126
- # # Updates the receiver in-place, merging in the hash passed as argument:
127
- # #
128
- # # hash_1 = ActiveSupport::HashWithIndifferentAccess.new
129
- # # hash_1[:key] = 'value'
130
- # #
131
- # # hash_2 = ActiveSupport::HashWithIndifferentAccess.new
132
- # # hash_2[:key] = 'New Value!'
133
- # #
134
- # # hash_1.update(hash_2) # => {"key"=>"New Value!"}
135
- # #
136
- # # The argument can be either an
137
- # # <tt>ActiveSupport::HashWithIndifferentAccess</tt> or a regular +Hash+.
138
- # # In either case the merge respects the semantics of indifferent access.
139
- # #
140
- # # If the argument is a regular hash with keys +:key+ and +"key"+ only one
141
- # # of the values end up in the receiver, but which one is unspecified.
142
- # #
143
- # # When given a block, the value for duplicated keys will be determined
144
- # # by the result of invoking the block with the duplicated key, the value
145
- # # in the receiver, and the value in +other_hash+. The rules for duplicated
146
- # # keys follow the semantics of indifferent access:
147
- # #
148
- # # hash_1[:key] = 10
149
- # # hash_2['key'] = 12
150
- # # hash_1.update(hash_2) { |key, old, new| old + new } # => {"key"=>22}
151
- # def update(other_hash)
152
- # if other_hash.is_a? HashWithIndifferentAccess
153
- # super(other_hash)
154
- # else
155
- # other_hash.to_hash.each_pair do |key, value|
156
- # if block_given? && key?(key)
157
- # value = yield(convert_key(key), self[key], value)
158
- # end
159
- # regular_writer(convert_key(key), convert_value(value))
160
- # end
161
- # self
162
- # end
163
- # end
164
-
165
- # alias_method :merge!, :update
166
-
167
- # # Checks the hash for a key matching the argument passed in:
168
- # #
169
- # # hash = ActiveSupport::HashWithIndifferentAccess.new
170
- # # hash['key'] = 'value'
171
- # # hash.key?(:key) # => true
172
- # # hash.key?('key') # => true
173
- # def key?(key)
174
- # super(convert_key(key))
175
- # end
176
-
177
- # alias_method :include?, :key?
178
- # alias_method :has_key?, :key?
179
- # alias_method :member?, :key?
180
-
181
- # # Same as <tt>Hash#[]</tt> where the key passed as argument can be
182
- # # either a string or a symbol:
183
- # #
184
- # # counters = ActiveSupport::HashWithIndifferentAccess.new
185
- # # counters[:foo] = 1
186
- # #
187
- # # counters['foo'] # => 1
188
- # # counters[:foo] # => 1
189
- # # counters[:zoo] # => nil
190
- # def [](key)
191
- # super(convert_key(key))
192
- # end
193
-
194
- # # Same as <tt>Hash#fetch</tt> where the key passed as argument can be
195
- # # either a string or a symbol:
196
- # #
197
- # # counters = ActiveSupport::HashWithIndifferentAccess.new
198
- # # counters[:foo] = 1
199
- # #
200
- # # counters.fetch('foo') # => 1
201
- # # counters.fetch(:bar, 0) # => 0
202
- # # counters.fetch(:bar) { |key| 0 } # => 0
203
- # # counters.fetch(:zoo) # => KeyError: key not found: "zoo"
204
- # def fetch(key, *extras)
205
- # super(convert_key(key), *extras)
206
- # end
207
-
208
- # # Returns an array of the values at the specified indices:
209
- # #
210
- # # hash = ActiveSupport::HashWithIndifferentAccess.new
211
- # # hash[:a] = 'x'
212
- # # hash[:b] = 'y'
213
- # # hash.values_at('a', 'b') # => ["x", "y"]
214
- # def values_at(*indices)
215
- # indices.collect { |key| self[convert_key(key)] }
216
- # end
217
-
218
- # # Returns an array of the values at the specified indices, but also
219
- # # raises an exception when one of the keys can't be found.
220
- # #
221
- # # hash = ActiveSupport::HashWithIndifferentAccess.new
222
- # # hash[:a] = 'x'
223
- # # hash[:b] = 'y'
224
- # # hash.fetch_values('a', 'b') # => ["x", "y"]
225
- # # hash.fetch_values('a', 'c') { |key| 'z' } # => ["x", "z"]
226
- # # hash.fetch_values('a', 'c') # => KeyError: key not found: "c"
227
- # def fetch_values(*indices, &block)
228
- # indices.collect { |key| fetch(key, &block) }
229
- # end if Hash.method_defined?(:fetch_values)
230
-
231
- # # Returns a shallow copy of the hash.
232
- # #
233
- # # hash = ActiveSupport::HashWithIndifferentAccess.new({ a: { b: 'b' } })
234
- # # dup = hash.dup
235
- # # dup[:a][:c] = 'c'
236
- # #
237
- # # hash[:a][:c] # => nil
238
- # # dup[:a][:c] # => "c"
239
- # def dup
240
- # self.class.new(self).tap do |new_hash|
241
- # set_defaults(new_hash)
242
- # end
243
- # end
244
-
245
- # # This method has the same semantics of +update+, except it does not
246
- # # modify the receiver but rather returns a new hash with indifferent
247
- # # access with the result of the merge.
248
- # def merge(hash, &block)
249
- # dup.update(hash, &block)
250
- # end
251
-
252
- # # Like +merge+ but the other way around: Merges the receiver into the
253
- # # argument and returns a new hash with indifferent access as result:
254
- # #
255
- # # hash = ActiveSupport::HashWithIndifferentAccess.new
256
- # # hash['a'] = nil
257
- # # hash.reverse_merge(a: 0, b: 1) # => {"a"=>nil, "b"=>1}
258
- # def reverse_merge(other_hash)
259
- # super(self.class.new(other_hash))
260
- # end
261
- # alias_method :with_defaults, :reverse_merge
262
-
263
- # # Same semantics as +reverse_merge+ but modifies the receiver in-place.
264
- # def reverse_merge!(other_hash)
265
- # replace(reverse_merge(other_hash))
266
- # end
267
- # alias_method :with_defaults!, :reverse_merge!
268
-
269
- # # Replaces the contents of this hash with other_hash.
270
- # #
271
- # # h = { "a" => 100, "b" => 200 }
272
- # # h.replace({ "c" => 300, "d" => 400 }) # => {"c"=>300, "d"=>400}
273
- # def replace(other_hash)
274
- # super(self.class.new(other_hash))
275
- # end
276
-
277
- # # Removes the specified key from the hash.
278
- # def delete(key)
279
- # super(convert_key(key))
280
- # end
281
-
282
- # def stringify_keys!; self end
283
- # def deep_stringify_keys!; self end
284
- # def stringify_keys; dup end
285
- # def deep_stringify_keys; dup end
286
- # # undef :symbolize_keys!
287
- # # undef :deep_symbolize_keys!
288
- # def symbolize_keys; to_hash.symbolize_keys! end
289
- # def deep_symbolize_keys; to_hash.deep_symbolize_keys! end
290
- # def to_options!; self end
291
-
292
- # def select(*args, &block)
293
- # return to_enum(:select) unless block_given?
294
- # dup.tap { |hash| hash.select!(*args, &block) }
295
- # end
296
-
297
- # def reject(*args, &block)
298
- # return to_enum(:reject) unless block_given?
299
- # dup.tap { |hash| hash.reject!(*args, &block) }
300
- # end
301
-
302
- # def transform_values(*args, &block)
303
- # return to_enum(:transform_values) unless block_given?
304
- # dup.tap { |hash| hash.transform_values!(*args, &block) }
305
- # end
306
-
307
- # def compact
308
- # dup.tap(&:compact!)
309
- # end
310
-
311
- # # Convert to a regular hash with string keys.
312
- # def to_hash
313
- # _new_hash = Hash.new
314
- # set_defaults(_new_hash)
315
-
316
- # each do |key, value|
317
- # _new_hash[key] = convert_value(value, for: :to_hash)
318
- # end
319
- # _new_hash
320
- # end
321
-
322
- # private
323
- # def convert_key(key) # :doc:
324
- # key.kind_of?(Symbol) ? key.to_s : key
325
- # end
326
-
327
- # def convert_value(value, options = {}) # :doc:
328
- # if value.is_a? Hash
329
- # if options[:for] == :to_hash
330
- # value.to_hash
331
- # else
332
- # value.class == Hash ? HashWithIndifferentAccess.new(value) : value
333
- # end
334
- # elsif value.is_a?(Array)
335
- # if options[:for] != :assignment || value.frozen?
336
- # value = value.dup
337
- # end
338
- # value.map! { |e| convert_value(e, options) }
339
- # else
340
- # value
341
- # end
342
- # end
343
-
344
- # def set_defaults(target) # :doc:
345
- # if default_proc
346
- # target.default_proc = default_proc.dup
347
- # else
348
- # target.default = default
349
- # end
350
- # end
351
- # end
352
-