medea 0.2.5 → 0.2.6
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/lib/medea/jasondeferredquery.rb +5 -3
- data/lib/medea/jasonobject.rb +6 -5
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.6
|
@@ -27,7 +27,9 @@ module Medea
|
|
27
27
|
self.contents = []
|
28
28
|
end
|
29
29
|
|
30
|
-
|
30
|
+
field = name.to_s
|
31
|
+
|
32
|
+
if field =~ /^members_of$/
|
31
33
|
#use the type and key of the first arg (being a JasonObject)
|
32
34
|
#args[0] must be a JasonObject (or child)
|
33
35
|
raise ArgumentError, "When looking for members, you must pass a JasonObject" unless args[0].is_a? JasonObject
|
@@ -35,7 +37,7 @@ module Medea
|
|
35
37
|
self.filters[:DATA_FILTER] ||= {}
|
36
38
|
self.filters[:DATA_FILTER]["__member_of"] ||= []
|
37
39
|
self.filters[:DATA_FILTER]["__member_of"] << args[0].jason_key
|
38
|
-
elsif
|
40
|
+
elsif field =~ /^find_by_(.*)$/
|
39
41
|
#use the property name from the name variable, and the value from the first arg
|
40
42
|
add_data_filter $1, args[0].to_s
|
41
43
|
else
|
@@ -122,4 +124,4 @@ module Medea
|
|
122
124
|
end
|
123
125
|
end
|
124
126
|
end
|
125
|
-
end
|
127
|
+
end
|
data/lib/medea/jasonobject.rb
CHANGED
@@ -60,10 +60,10 @@ module Medea
|
|
60
60
|
#Will return a JasonDeferredQuery for this class with the appropriate data filter set
|
61
61
|
def JasonObject.method_missing(name, *args, &block)
|
62
62
|
q = JasonDeferredQuery.new self
|
63
|
-
if name =~ /^members_of$/
|
63
|
+
if name.to_s =~ /^members_of$/
|
64
64
|
#use the type and key of the first arg (being a JasonObject)
|
65
65
|
return q.members_of args[0]
|
66
|
-
elsif name =~ /^find_by_(.*)$/
|
66
|
+
elsif name.to_s =~ /^find_by_(.*)$/
|
67
67
|
#use the property name from the name variable, and the value from the first arg
|
68
68
|
q.add_data_filter $1, args[0]
|
69
69
|
|
@@ -90,13 +90,14 @@ module Medea
|
|
90
90
|
# Assigning any attribute will add it to the object's hash (and then be POSTed to JasonDB on the next save)
|
91
91
|
def method_missing(name, *args, &block)
|
92
92
|
load if @__jason_state == :ghost
|
93
|
-
|
93
|
+
field = name.to_s
|
94
|
+
if field =~ /(.*)=$/ # We're assigning
|
94
95
|
@__jason_state = :dirty if @__jason_state == :stale
|
95
96
|
self[$1] = args[0]
|
96
|
-
elsif
|
97
|
+
elsif field =~ /(.*)\?$/ # We're asking
|
97
98
|
(self[$1] ? true : false)
|
98
99
|
else
|
99
|
-
self[
|
100
|
+
self[field]
|
100
101
|
end
|
101
102
|
end
|
102
103
|
#end "flexihash" access
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: medea
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 6
|
10
|
+
version: 0.2.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Michael Jensen
|