thoughtful 0.0.7 → 0.0.8
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/thoughtful/object.rb +5 -1
- data/lib/thoughtful/version.rb +1 -1
- data/test/thoughtful/object_test.rb +12 -0
- data/website/index.html +1 -1
- metadata +1 -1
data/lib/thoughtful/object.rb
CHANGED
@@ -10,6 +10,10 @@ class Object
|
|
10
10
|
def not
|
11
11
|
Not.new(self)
|
12
12
|
end
|
13
|
+
|
14
|
+
def __negate__
|
15
|
+
!self
|
16
|
+
end
|
13
17
|
|
14
18
|
class Not
|
15
19
|
private(*instance_methods.select { |m| m !~ /(^__|^\W|^binding$)/ })
|
@@ -19,7 +23,7 @@ class Object
|
|
19
23
|
end
|
20
24
|
|
21
25
|
def method_missing(sym, *args, &blk)
|
22
|
-
|
26
|
+
@subject.send(sym,*args,&blk).__negate__
|
23
27
|
end
|
24
28
|
end
|
25
29
|
end
|
data/lib/thoughtful/version.rb
CHANGED
@@ -24,4 +24,16 @@ Expectations do
|
|
24
24
|
expect true do
|
25
25
|
Object.not.nil?
|
26
26
|
end
|
27
|
+
|
28
|
+
expect :custom_negate do
|
29
|
+
instance = Object.new
|
30
|
+
def instance.obj_that_responds_to_negate
|
31
|
+
result = Object.new
|
32
|
+
def result.__negate__
|
33
|
+
:custom_negate
|
34
|
+
end
|
35
|
+
result
|
36
|
+
end
|
37
|
+
instance.not.obj_that_responds_to_negate
|
38
|
+
end
|
27
39
|
end
|
data/website/index.html
CHANGED
@@ -33,7 +33,7 @@
|
|
33
33
|
<h1>thoughtful</h1>
|
34
34
|
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/thoughtful"; return false'>
|
35
35
|
<p>Get Version</p>
|
36
|
-
<a href="http://rubyforge.org/projects/thoughtful" class="numbers">0.0.
|
36
|
+
<a href="http://rubyforge.org/projects/thoughtful" class="numbers">0.0.8</a>
|
37
37
|
</div>
|
38
38
|
<h1>→ ‘thoughtful’</h1>
|
39
39
|
|