Sha256: 539837a17a25d69b0aa7e3ec4aebc587e3e07a1e6dff063895a48dfb52cb2560
Contents?: true
Size: 967 Bytes
Versions: 2
Compression:
Stored size: 967 Bytes
Contents
# `NilClass` has a single instance `nil`. No more instances of this # class can be created, and attempts to do so will yield an error. # # Implementation details # ---------------------- # # `nil` is an actual ruby object, and is not just a reference to the # native `null` or `undefined` values in javascript. Sending messages to # `nil` in ruby is a very useful feature of ruby, and this would not be # possible in opal if `nil` was just the `null` or `undefined` value. # # To access `nil` from javascript, `Qnil` points to this instance and is # available in both ruby and javascript sources loaded by opal. class NilClass def to_i 0 end def to_f 0.0 end def to_s "" end def to_a [] end def inspect "nil" end def nil? true end def &(other) false end def |(other) `return other != false && other != nil;` end def ^(other) `return other != false && other != nil;` end end NIL = nil
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
opal-0.3.10 | corelib/nil_class.rb |
opal-0.3.9 | corelib/nil_class.rb |