delegate_all_for 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  module DelegateAllFor
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -22,17 +22,17 @@ module DelegateAllFor
22
22
  options.assert_valid_keys(:except, :also_include)
23
23
 
24
24
  exclude_columns = self.column_names.dup.concat(options[:except].map(&:to_s))
25
- puts exclude_columns.inspect
26
25
  attr_names.each do |association_name|
27
26
  if reflection = reflect_on_association(association_name)
28
27
  options[:also_include].each do |m|
29
28
  class_eval(%{delegate :#{m}, :to => :#{association_name}})
30
29
  end
31
- puts (reflection.klass.column_names - exclude_columns).inspect
32
30
  (reflection.klass.column_names - exclude_columns).each do |column_name|
33
- class_eval(%{delegate :#{column_name}, :to => :#{association_name}})
34
- class_eval(%{delegate :#{column_name}=, :to => :#{association_name}})
35
- class_eval(%{delegate :#{column_name}?, :to => :#{association_name}})
31
+ class_eval <<-eoruby, __FILE__, __LINE__ + 1
32
+ delegate :#{column_name}, :to => :#{association_name}
33
+ delegate :#{column_name}=, :to => :#{association_name}
34
+ delegate :#{column_name}?, :to => :#{association_name}
35
+ eoruby
36
36
  end
37
37
  else
38
38
  raise ArgumentError, "No association found for name `#{association_name}'. Has it been defined yet?"
@@ -43,4 +43,4 @@ end
43
43
 
44
44
  if defined?(ActiveRecord::Base)
45
45
  ActiveRecord::Base.extend DelegateAllFor
46
- end
46
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: delegate_all_for
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: