ryana-inequal_opportunity 0.1.0 → 0.1.1
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/inequal_opportunity.rb +20 -1
- metadata +1 -1
data/lib/inequal_opportunity.rb
CHANGED
@@ -11,6 +11,19 @@ module ActiveRecord
|
|
11
11
|
def operator
|
12
12
|
raise('Nope')
|
13
13
|
end
|
14
|
+
|
15
|
+
def ==(val)
|
16
|
+
self.operator == val.operator && self.value == val.value
|
17
|
+
end
|
18
|
+
|
19
|
+
def string_value
|
20
|
+
value ? "'#{value}'" : 'nil'
|
21
|
+
end
|
22
|
+
|
23
|
+
def inspect
|
24
|
+
" #{operator} #{self.string_value}"
|
25
|
+
end
|
26
|
+
|
14
27
|
end
|
15
28
|
|
16
29
|
class GreaterThanEqual < Base
|
@@ -39,7 +52,13 @@ module ActiveRecord
|
|
39
52
|
|
40
53
|
class NotEqual < Base
|
41
54
|
def operator
|
42
|
-
|
55
|
+
if value.nil?
|
56
|
+
'IS NOT'
|
57
|
+
elsif value.is_a? Array
|
58
|
+
'NOT IN'
|
59
|
+
else
|
60
|
+
'<>'
|
61
|
+
end
|
43
62
|
end
|
44
63
|
end
|
45
64
|
|