metasploit-framework/lib/rkelly/js/nan.rb

19 lines
325 B
Ruby
Raw Normal View History

module RKelly
module JS
# Class to represent Not A Number
# In Ruby NaN != NaN, but in JS, NaN == NaN
class NaN < ::Numeric
def ==(other)
other.respond_to?(:nan?) && other.nan?
end
def nan?
true
end
def +(o); self; end
def -(o); self; end
end
end
end