wedge 0.1.27 → 0.1.28

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: ba0be879ee1b94a82058b859b81158d007857459
4
- data.tar.gz: bcde1a92dca708f06db7f2a76fcd4853773b059e
3
+ metadata.gz: 3913599441bd30d96674703f6fa919555aaea4d0
4
+ data.tar.gz: 2123f5cb611151898d93214c27cf7f82155b43cb
5
5
  SHA512:
6
- metadata.gz: 2157a1e3dd32a64c515cfd554e34b53d48fd3fe7fe53ac4189a79093acec78598474945b4d75cf4934b3b0dd47b82205f37b6b853d2cb3da3060dcda89388093
7
- data.tar.gz: 371744fea67678c24ba6525e3a41bb915a3e0f1d59ef916f5db1a8716056797cc3e4e0ad2001cb4bd65aa207c444b35f8dbbb3b6861e21df9ae6c82f1bb061e2
6
+ metadata.gz: f1885d7df5a210bfabed28316ce1f3095173e7b15ac7ae92c673409196fdb555fa4e9121e83129760b5ab6aa87a2a72b611bf5ee0488089404f9d2e1c6467ace
7
+ data.tar.gz: cc8fe2193c97129f3f2f3df1c821851da091e39c2c49a30cefb319fbb338864aa918bd4a927e4f48987c88fc80dc8a51f0f93affd93b1e24a0cbee2b0d149de2
@@ -120,7 +120,7 @@ class Wedge
120
120
 
121
121
  def process_value val, opts
122
122
  # Make sure the value is the correct type
123
- if type = opts[:type]
123
+ if !val.nil? && type = opts[:type]
124
124
  val = case type
125
125
  when 'Integer'
126
126
  val.to_i
@@ -161,9 +161,14 @@ class Wedge
161
161
  def attr_reader(*attrs, &block)
162
162
  default_opts = { read_only: true }
163
163
  opts = attrs.pop
164
- opts.merge!(default_opts) if opts.is_a? Hash
165
164
 
166
- attrs << opts
165
+ if opts.is_a? Hash
166
+ default_opts.merge! opts
167
+ attrs << default_opts.merge!(opts)
168
+ else
169
+ attrs << opts
170
+ attrs << default_opts
171
+ end
167
172
 
168
173
  attr_accessor(*attrs, &block)
169
174
  end
@@ -323,8 +328,8 @@ class Wedge
323
328
  _options[:_model_attributes] = for_model
324
329
 
325
330
  _keys.each do |att|
326
- opts = _accessor_options[att]
327
- if _atts.can_read?(att) && (!opts[:hidden] || opts[:hidden].is_a?(Proc) && !self.instance_exec(&opts[:hidden]))
331
+ opts = _accessor_options[att].indifferent
332
+ if ((for_model && !opts[:read_only]) || !for_model) && _atts.can_read?(att) && (!opts[:hidden] || opts[:hidden].is_a?(Proc) && !self.instance_exec(&opts[:hidden]))
328
333
  is_form = opts[:form]
329
334
  key = for_model ? _aliases[att] || att : att
330
335
  key = (for_model && is_form)? "#{key}_attributes" : key
@@ -1,3 +1,3 @@
1
1
  class Wedge
2
- VERSION = '0.1.27'
2
+ VERSION = '0.1.28'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wedge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.27
4
+ version: 0.1.28
5
5
  platform: ruby
6
6
  authors:
7
7
  - cj
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-05 00:00:00.000000000 Z
11
+ date: 2015-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opal