yt-andrewroth 0.25.5.1 → 0.25.5.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/yt/associations/has_attribute.rb +10 -2
- data/lib/yt/associations/has_many.rb +2 -2
- data/lib/yt/version.rb +1 -1
- metadata +3 -3
@@ -44,8 +44,16 @@ module Yt
|
|
44
44
|
|
45
45
|
define_method name do
|
46
46
|
value = instance_variable_get ivar_name
|
47
|
-
|
48
|
-
|
47
|
+
instance_variable_set ivar_name, value || instance_eval(&method)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# This version never uses the cache, but does set the instance variable.
|
52
|
+
# Just testing to see if I can get something reliable.
|
53
|
+
def define_memoized_method2(name, &method)
|
54
|
+
ivar_name = "@#{name.to_s.gsub /[?!]$/, ''}"
|
55
|
+
|
56
|
+
define_method name do
|
49
57
|
instance_variable_set ivar_name, instance_eval(&method)
|
50
58
|
end
|
51
59
|
end
|
@@ -15,8 +15,8 @@ module Yt
|
|
15
15
|
require "yt/collections/#{attributes}"
|
16
16
|
collection_name = attributes.to_s.sub(/.*\./, '').camelize.pluralize
|
17
17
|
collection = "Yt::Collections::#{collection_name}".constantize
|
18
|
-
|
18
|
+
define_memoized_method2(attributes) { collection.of self }
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
22
|
-
end
|
22
|
+
end
|
data/lib/yt/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yt-andrewroth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 151
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 25
|
9
9
|
- 5
|
10
|
-
-
|
11
|
-
version: 0.25.5.
|
10
|
+
- 2
|
11
|
+
version: 0.25.5.2
|
12
12
|
platform: ruby
|
13
13
|
authors:
|
14
14
|
- Claudio Baccigalupo
|