delegate_associations 0.1.1 → 0.1.2

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: 22ccbcdafc0f4379a1a417536d79c064593591bc
4
- data.tar.gz: 16f7e0d12d5b677624ae7e0351f16471aae63e7e
3
+ metadata.gz: 55c8f939e00d88a8e04e455fc167cc48c9554899
4
+ data.tar.gz: f35d2be7abd236669c2762ade7824df8893b03b6
5
5
  SHA512:
6
- metadata.gz: d5f8833dad08cfc2cdffe854eb2816fce31b8938a2381bc0619ad66e5201f50ca325ba69ca3f24237e0fb952124f8b78578581df7669258623c90119e89fa434
7
- data.tar.gz: a1ac3a821bc4164e6d35d8c515e59f07feb61774bbc58562440544c1ee3a8592baa2402ace3e31d4a67a7cd6427580225c8ad91d0e9b64c84d07a1ea7fbda11c
6
+ metadata.gz: 788c54a7ff87d649d6dd3915c00431b66fe1dea43b243afc4fd789b92702990f0ea410afa66bf2869728a715239df157b510451047dce4d1f338a8f99f00e226
7
+ data.tar.gz: b2408877c82375762870110e126d5f607335dcb9bf5c614efffb70d208f6caa9a6df98ad84bc20e74a8503dbfccffdd6d87a038961712135531a65802bb73d0c
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "delegate_associations"
3
- s.version = "0.1.1"
3
+ s.version = "0.1.2"
4
4
  s.description = "A gem for delegate attributes and associations of belongs_to and has_one"
5
5
  s.summary = "A gem for delegate attributes and associations of belongs_to and has_one"
6
6
  s.homepage = "https://github.com/Brunomm/delegate_associations"
@@ -12,13 +12,13 @@ module DelegateAssociations
12
12
  associations = [options.delete(:to)].flatten.compact.map!(&:to_sym)
13
13
  valid_associations_to(associations)
14
14
 
15
- exept = [options[:exept]].flatten.compact.map!(&:to_sym)
15
+ except = [options[:except]].flatten.compact.map!(&:to_sym)
16
16
  only = [options[:only]].flatten.compact.map!(&:to_sym)
17
- exept += delegate_exclude_columns
17
+ except += delegate_exclude_columns
18
18
 
19
19
  associations.each do |association|
20
20
  reflect_on_association(association).klass.reflect_on_all_associations.each do |ass|
21
- next unless ass.name.in?(get_deletage_methods(reflect_on_association(association).klass.reflect_on_all_associations.map(&:name), exept, only))
21
+ next unless ass.name.in?(get_deletage_methods(reflect_on_association(association).klass.reflect_on_all_associations.map(&:name), except, only))
22
22
  if ass.collection?
23
23
  delegate "#{ass.name}", to: association, allow_nil: options[:allow_nil]
24
24
  delegate "#{ass.name}=", to: association, allow_nil: options[:allow_nil]
@@ -42,12 +42,12 @@ module DelegateAssociations
42
42
  #Valid if have an option[:to] and if association exists
43
43
  valid_associations_to(associations)
44
44
 
45
- exept = [options[:exept]].flatten.compact.map!(&:to_sym)
45
+ except = [options[:except]].flatten.compact.map!(&:to_sym)
46
46
  only = [options[:only]].flatten.compact.map!(&:to_sym)
47
- exept += delegate_exclude_columns
47
+ except += delegate_exclude_columns
48
48
 
49
49
  associations.each do |association|
50
- get_deletage_methods(reflect_on_association(association).klass.column_names, exept, only).each do |attribute|
50
+ get_deletage_methods(reflect_on_association(association).klass.column_names, except, only).each do |attribute|
51
51
  options[:suffix].each do |sf|
52
52
  delegate "#{attribute}#{sf}", to: association, allow_nil: options[:allow_nil]
53
53
  end
@@ -57,9 +57,9 @@ module DelegateAssociations
57
57
 
58
58
  private
59
59
 
60
- def get_deletage_methods(all_options, exept, only)
60
+ def get_deletage_methods(all_options, except, only)
61
61
  return (all_options.map(&:to_sym)&only)-delegate_exclude_columns if only.any?
62
- all_options.map(&:to_sym) - exept
62
+ all_options.map(&:to_sym) - except
63
63
  end
64
64
 
65
65
  def valid_associations_to(associations)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: delegate_associations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bruno Mucelini Mergen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-08 00:00:00.000000000 Z
11
+ date: 2015-05-11 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A gem for delegate attributes and associations of belongs_to and has_one
14
14
  email: