struct Null

Defined in:

nason/null.cr

Constructors

Instance Method Summary

Instance methods inherited from struct Value

==(other : NASON::Any) ==

Instance methods inherited from class Object

===(other : NASON::Any) ===, nil_or_null? nil_or_null?, not_null! not_null!, null? null?, to_nason(io : IO) : Nil
to_nason : String
to_nason
, to_pretty_json(indent : String = " ") : String
to_pretty_json(io : IO, indent : String = " ") : Nil
to_pretty_json

Class methods inherited from class Object

from_nason(string_or_io, root : String)
from_nason(string_or_io)
from_nason

Constructor Detail

def self.new(pull : NASON::PullParser) #

[View source]
def self.new #

[View source]
def self.null : Null #

[View source]

Instance Method Detail

def ==(other : Null) #

Returns 0_u64. Even though Null is not a Reference type, it is usually mixed with them to form nilable types so it's useful to have an object id for nil. Returns true: Null has only one singleton value: nil.


[View source]
def clone #

[View source]
def inspect(io : IO) : Nil #

Writes "null" to the given IO.


[View source]
def inspect : String #

Returns "nil".


[View source]
def not_nil! : Null #

Raises NullAssertionError.

See also: Object#not_nil!.


[View source]
def not_null! : NoReturn #

[View source]
def presence : Nil #

Returns self. This method enables to call the #presence method (see String#presence) on a union with Null. The idea is to return nil when the value is nil or empty.

config = {"empty" => ""}
config["empty"]?.presence   # => nil
config["missing"]?.presence # => nil

[View source]
def same?(other : Null) #

Returns true: Null has only one singleton value: nil.


[View source]
def same?(other : Reference) : Bool #

Returns false.


[View source]
def to_json_object_key : String #

[View source]
def to_nason(nson : NASON::Builder) : Nil #

[View source]
def to_s(io : IO) : Nil #

Appends "null" to the given IO.


[View source]
def to_s : String #

Returns "null"


[View source]
def to_yaml(yaml : YAML::Nodes::Builder) : Nil #

[View source]
def try(&) #

Doesn't yield to the block.

See also: Object#try.


[View source]