class NilConditional
Nil Conditional class
Public Class Methods
new(object)
click to toggle source
# File lib/nil_conditional.rb, line 12 def initialize(object) @object = object end
Public Instance Methods
==(other)
click to toggle source
Calls superclass method
# File lib/nil_conditional.rb, line 33 def ==(other) return true if other.nil? super end
eql?(other)
click to toggle source
Calls superclass method
# File lib/nil_conditional.rb, line 38 def eql?(other) return true if other.eql?(nil) super end
method_missing(name, *params)
click to toggle source
# File lib/nil_conditional.rb, line 16 def method_missing(name, *params) if @object.respond_to?(name) return_value = nil if block_given? return_value = @object.public_send(name, *params, &Proc.new) else return_value = @object.public_send(name, *params) end return return_value unless return_value.nil? end self.class.new(@object) end
nil?()
click to toggle source
# File lib/nil_conditional.rb, line 29 def nil? true end