Class: NilClass

Inherits:
Object show all
Defined in:
opal/stdlib/json.rb,
opal/stdlib/native.rb,
opal/stdlib/bigdecimal/util.rb

Instance Method Summary collapse

Instance Method Details

#to_dObject

call-seq: nil.to_d -> bigdecimal

Returns nil represented as a BigDecimal.

require 'bigdecimal'
require 'bigdecimal/util'

nil.to_d   # => 0.0


145
146
147
# File 'opal/stdlib/bigdecimal/util.rb', line 145

def to_d
  BigDecimal(0)
end

#to_jsonObject



177
178
179
# File 'opal/stdlib/json.rb', line 177

def to_json
  'null'
end

#to_nObject

Returns the corresponding JavaScript value (null).

Returns:

  • the corresponding JavaScript value (null).



527
528
529
# File 'opal/stdlib/native.rb', line 527

def to_n
  `null`
end