inherits_values_from 0.0.2 → 0.0.3
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.
- data/lib/inherits_values_from.rb +4 -3
- data/lib/inherits_values_from/version.rb +1 -1
- metadata +4 -4
data/lib/inherits_values_from.rb
CHANGED
@@ -2,14 +2,13 @@ require 'inherits_values_from/version.rb'
|
|
2
2
|
|
3
3
|
module InheritsValuesFrom
|
4
4
|
|
5
|
-
|
6
|
-
base.extend ClassMethods
|
7
|
-
end
|
5
|
+
extend ActiveSupport::Concern
|
8
6
|
|
9
7
|
module ClassMethods
|
10
8
|
|
11
9
|
def inherits_values_from(model, values)
|
12
10
|
values.each do |local, far|
|
11
|
+
far = local if far.nil? # It's an array
|
13
12
|
define_method(local) do
|
14
13
|
if self[local].nil?
|
15
14
|
self.method(model).call[far]
|
@@ -23,3 +22,5 @@ module InheritsValuesFrom
|
|
23
22
|
end
|
24
23
|
|
25
24
|
end
|
25
|
+
|
26
|
+
ActiveRecord::Base.send(:include, InheritsValuesFrom)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inherits_values_from
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,9 +9,9 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-11 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
|
-
description:
|
14
|
+
description: ''
|
15
15
|
email: colin@burn-murdoch.com
|
16
16
|
executables: []
|
17
17
|
extensions: []
|
@@ -19,7 +19,7 @@ extra_rdoc_files: []
|
|
19
19
|
files:
|
20
20
|
- lib/inherits_values_from.rb
|
21
21
|
- lib/inherits_values_from/version.rb
|
22
|
-
homepage: http://
|
22
|
+
homepage: http://rubygems.org/gems/inherits_values_from
|
23
23
|
licenses: []
|
24
24
|
post_install_message:
|
25
25
|
rdoc_options: []
|