cache_tree 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/VERSION +1 -1
- data/cache_tree.gemspec +1 -1
- data/lib/cache_tree.rb +14 -2
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
data/cache_tree.gemspec
CHANGED
data/lib/cache_tree.rb
CHANGED
@@ -69,9 +69,22 @@ module CacheTree
|
|
69
69
|
include Tree::Node
|
70
70
|
|
71
71
|
def initialize(target)
|
72
|
+
if target.is_a?(Hash)
|
73
|
+
initialize_from_hash(target)
|
74
|
+
else
|
75
|
+
initialize_from_object(target)
|
76
|
+
end
|
77
|
+
@stamp = generate_stamp
|
78
|
+
end
|
79
|
+
|
80
|
+
def initialize_from_hash(hash)
|
81
|
+
@name = hash[:name]
|
82
|
+
@value = hash[:value]
|
83
|
+
end
|
84
|
+
|
85
|
+
def initialize_from_object(target)
|
72
86
|
@name = target.class.name.gsub(/([A-Z])/) { "_#{$1}" }.gsub(/^./, '').downcase
|
73
87
|
@value = target.id
|
74
|
-
@stamp = generate_stamp
|
75
88
|
end
|
76
89
|
|
77
90
|
def directory
|
@@ -168,7 +181,6 @@ module CacheTree
|
|
168
181
|
nil
|
169
182
|
end
|
170
183
|
|
171
|
-
|
172
184
|
end
|
173
185
|
|
174
186
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cache_tree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- kazuyoshi tlacaelel
|