frenchy 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: 931d5b6b257afcf71c97aa158f1cbed36e466991
4
- data.tar.gz: 764c993fcab9b80d3960a9fb76b7c56abd833f04
3
+ metadata.gz: b9bcb2bcc3f11278f88a3bb50be78b459819fb7f
4
+ data.tar.gz: e1910af141550b7eb50534ac609c1657e1244b0a
5
5
  SHA512:
6
- metadata.gz: 44b3e312031783089e903ad9729b8bbd3c3a867ae5275a03db61d046e4f6c8e99267aff95eea23fa0e66faffaf7812f4531f9defbbf3488b538a6d5981e0aef3
7
- data.tar.gz: 9375a0660f5a6f60100e5f513b6cfa67ace92dbdd3776344d484b0bd9387dc9f87645a1423f93859e56bef936572170bd19360b2d5dff990ff40e04e504db798
6
+ metadata.gz: 7a76e4478486f1680b5b534c614a3d0b2ce5055be3c17c671fd29c432795c44b691a565e43f6b9f8e5e0572a34874274ac0f0b737c743c9e11cf8d94cec3538f
7
+ data.tar.gz: e88fa62c9009e507ce356163093a2c1ac1bf8be4f896c58ba51c04e9ed2a81db7ce6d8ca02eb2bdc527f32a43efec3ed6e28e6a727d84855c97952a265d1dcb1
data/lib/frenchy/model.rb CHANGED
@@ -117,9 +117,12 @@ module Frenchy
117
117
  options[:many] = (name.to_s.singularize != name.to_s) unless options.key?(:many)
118
118
  klass = options[:class_name].constantize
119
119
 
120
+ if options[:many]
121
+ options[:default] ||= []
122
+ end
123
+
120
124
  define_method("#{name}=") do |v|
121
125
  if options[:many]
122
- options[:default] ||= []
123
126
  set(name, Frenchy::Collection.new(Array(v).map {|vv| klass.new(vv)}))
124
127
  else
125
128
  set(name, klass.new(v))
@@ -1,3 +1,3 @@
1
1
  module Frenchy
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: frenchy
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
  - Jason Coene