class Null
The simplest NullObject there can be
Public Class Methods
==(other)
click to toggle source
# File lib/deterministic/null.rb, line 28 def ==(other) other.respond_to?(:null?) && other.null? end
instance()
click to toggle source
# File lib/deterministic/null.rb, line 12 def instance @instance ||= new([]) end
method_missing(m, *args)
click to toggle source
Calls superclass method
# File lib/deterministic/null.rb, line 4 def method_missing(m, *args) if m == :new super else Null.instance end end
mimic(klas)
click to toggle source
# File lib/deterministic/null.rb, line 24 def mimic(klas) new(klas.instance_methods(false)) end
new(methods)
click to toggle source
# File lib/deterministic/null.rb, line 34 def initialize(methods) @methods = methods end
null?()
click to toggle source
# File lib/deterministic/null.rb, line 16 def null? true end
some?()
click to toggle source
# File lib/deterministic/null.rb, line 20 def some? false end
Private Class Methods
new(obj)
click to toggle source
# File lib/deterministic/enum.rb, line 169 def initialize(obj) @obj = obj @matches = [] @vars = [] end
Public Instance Methods
==(other)
click to toggle source
# File lib/deterministic/null.rb, line 69 def ==(other) other.respond_to?(:null?) && other.null? end
inspect()
click to toggle source
# File lib/deterministic/null.rb, line 65 def inspect 'Null' end
method_missing(m, *args)
click to toggle source
Calls superclass method
# File lib/deterministic/null.rb, line 47 def method_missing(m, *args) return self if respond_to?(m) super end
null?()
click to toggle source
# File lib/deterministic/null.rb, line 52 def null? true end
respond_to?(m)
click to toggle source
Calls superclass method
# File lib/deterministic/null.rb, line 60 def respond_to?(m) return true if @methods.empty? || @methods.include?(m) super end
some?()
click to toggle source
# File lib/deterministic/null.rb, line 56 def some? false end
to_ary()
click to toggle source
# File lib/deterministic/null.rb, line 43 def to_ary [] end
to_str()
click to toggle source
implicit conversions
# File lib/deterministic/null.rb, line 39 def to_str '' end