class RubyJson

Defined in:

core/anyolite/json.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new #

Class Method Detail

def self.from(raw : RubyJsonType) #

def self.from_jsonany(any : JSON::Any) #

Instance Method Detail

def [](index : Int | String) : RubyJson #

Assumes the underlying value is an Array and returns the element at the given index. Raises if the underlying value is not an Array.


def []?(index : Int | String) : RubyJson | Nil #

Assumes the underlying value is an Array and returns the element at the given index, or nil if out of bounds. Raises if the underlying value is not an Array.


def as_a : Array(RubyJson) #

Checks that the underlying value is Array, and returns its value. Raises otherwise.


def as_a? : Array(RubyJson) | Nil #

Checks that the underlying value is Array, and returns its value. Returns nil otherwise.


def as_bool : Bool #

Checks that the underlying value is Bool, and returns its value. Raises otherwise.


def as_bool? : Bool | Nil #

Checks that the underlying value is Bool, and returns its value. Returns nil otherwise.


def as_f : Float64 #

Checks that the underlying value is Float (or Int), and returns its value as an Float64. Raises otherwise.


def as_f32 : Float32 #

Checks that the underlying value is Float (or Int), and returns its value as an Float32. Raises otherwise.


def as_f32? : Float32 | Nil #

Checks that the underlying value is Float (or Int), and returns its value as an Float32. Returns nil otherwise.


def as_f? : Float64 | Nil #

Checks that the underlying value is Float (or Int), and returns its value as an Float64. Returns nil otherwise.


def as_h : Hash(String, RubyJson) #

Checks that the underlying value is Hash, and returns its value. Raises otherwise.


def as_h? : Hash(String, RubyJson) | Nil #

Checks that the underlying value is Hash, and returns its value. Returns nil otherwise.


def as_i : Int32 #

Checks that the underlying value is Int, and returns its value as an Int32. Raises otherwise.


def as_i64 : Int64 #

Checks that the underlying value is Int, and returns its value as an Int64. Raises otherwise.


def as_i64? : Int64 | Nil #

Checks that the underlying value is Int, and returns its value as an Int64. Returns nil otherwise.


def as_i? : Int32 | Nil #

Checks that the underlying value is Int, and returns its value as an Int32. Returns nil otherwise.


def as_nil : Nil #

Checks that the underlying value is Nil, and returns nil. Raises otherwise.


def as_s : String #

Checks that the underlying value is String, and returns its value. Raises otherwise.


def as_s? : String | Nil #

Checks that the underlying value is String, and returns its value. Returns nil otherwise.


def raw=(raw : RubyJsonType) #

def size : Int #

Assumes the underlying value is an Array or Hash and returns its size. Raises if the underlying value is not an Array or Hash.


def to_jsonany #