Class: NotWrapper
- Inherits:
-
BasicObject
- Defined in:
- lib/epitools/core_ext/misc.rb
Overview
Instance Method Summary
collapse
Constructor Details
129
130
131
|
# File 'lib/epitools/core_ext/misc.rb', line 129
def initialize(orig)
@orig = orig
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &block) ⇒ Object
141
142
143
144
145
146
147
148
|
# File 'lib/epitools/core_ext/misc.rb', line 141
def method_missing(meth, *args, &block)
result = @orig.send(meth, *args, &block)
if result.is_a? ::TrueClass or result.is_a? ::FalseClass
!result
else
raise "Sorry, I don't know how to invert #{result.inspect}"
end
end
|
Instance Method Details
133
134
135
|
# File 'lib/epitools/core_ext/misc.rb', line 133
def inspect
"{NOT #{@orig.inspect}}"
end
|
#is_a?(other) ⇒ Boolean
137
138
139
|
# File 'lib/epitools/core_ext/misc.rb', line 137
def is_a?(other)
other === self
end
|