struct MessagePack::Any

Overview

A wrapper around a MessagePack object with convenience methods for type conversions

Defined in:

message_pack/any.cr
message_pack/to_msgpack.cr

Constructors

Instance Method Summary

Macro Summary

Instance methods inherited from class Object

===(other : MessagePack::Any) ===, to_msgpack(io : IO)
to_msgpack(packer : MessagePack::Packer)
to_msgpack
to_msgpack

Class methods inherited from class Object

from_msgpack(string_or_io, zero_copy = false) from_msgpack

Constructor Detail

def self.new(pull : MessagePack::Unpacker) #

[View source]
def self.new(raw : MessagePack::Type) #

[View source]

Instance Method Detail

def ==(arg) #
Description copied from struct Struct

Returns true if this struct is equal to other.

Both structs' instance vars are compared to each other. Thus, two structs are considered equal if each of their instance variables are equal. Subclasses should override this method to provide specific equality semantics.

struct Point
  def initialize(@x : Int32, @y : Int32)
  end
end

p1 = Point.new 1, 2
p2 = Point.new 1, 2
p3 = Point.new 3, 4

p1 == p2 # => true
p1 == p3 # => false

[View source]
def [](key : Symbol) : Any #

[View source]
def [](key : Type) : Any #

[View source]
def []?(key : Type) : Any | Nil #

[View source]
def as_a : Array(MessagePack::Type) #

Convert to Array(MessagePack::Type)


[View source]
def as_a? : Array(MessagePack::Type) | Nil #

Maybe convert to Array(MessagePack::Type)?


[View source]
def as_bool : Bool #

Convert to Bool


[View source]
def as_bool? : Bool | Nil #

Maybe convert to Bool?


[View source]
def as_f : Float64 #

Convert to Float64


[View source]
def as_f? : Float64 | Nil #

Maybe convert to Float64?


[View source]

Convert to Hash(MessagePack::Type, MessagePack::Type)


[View source]

Maybe convert to Hash(MessagePack::Type, MessagePack::Type)?


[View source]
def as_i #

[View source]
def as_i16 : Int16 #

Convert to Int16


[View source]
def as_i16? : Int16 | Nil #

Maybe convert to Int16?


[View source]
def as_i32 : Int32 #

Convert to Int32


[View source]
def as_i32? : Int32 | Nil #

Maybe convert to Int32?


[View source]
def as_i64 : Int64 #

Convert to Int64


[View source]
def as_i64? : Int64 | Nil #

Maybe convert to Int64?


[View source]
def as_i8 : Int8 #

Convert to Int8


[View source]
def as_i8? : Int8 | Nil #

Maybe convert to Int8?


[View source]
def as_i? #

[View source]
def as_nil : Nil #

Convert to Nil


[View source]
def as_nil? : Nil | Nil #

Maybe convert to Nil?


[View source]
def as_s : String #

Convert to String


[View source]
def as_s? : String | Nil #

Maybe convert to String?


[View source]
def as_u #

[View source]
def as_u16 : UInt16 #

Convert to UInt16


[View source]
def as_u16? : UInt16 | Nil #

Maybe convert to UInt16?


[View source]
def as_u32 : UInt32 #

Convert to UInt32


[View source]
def as_u32? : UInt32 | Nil #

Maybe convert to UInt32?


[View source]
def as_u64 : UInt64 #

Convert to UInt64


[View source]
def as_u64? : UInt64 | Nil #

Maybe convert to UInt64?


[View source]
def as_u8 : UInt8 #

Convert to UInt8


[View source]
def as_u8? : UInt8 | Nil #

Maybe convert to UInt8?


[View source]
def as_u? #

[View source]
def clone #

[View source]
def dig(key : Type) #

[View source]
def dig(key : Type, *subkeys) #

[View source]
def dig?(key : Type, *subkeys) #

[View source]
def dup #
Description copied from struct Value

Returns a shallow copy of this object.

Because Value is a value type, this method returns self, which already involves a shallow copy of this object because value types are passed by value.


[View source]
def each(&) #

[View source]
def inspect(*args, **options) #

[View source]
def inspect(*args, **options, &) #

[View source]
def raw : Type #

[View source]
def size #

[View source]
def to_msgpack(packer : MessagePack::Packer) #

[View source]
def to_s(*args, **options) #

[View source]
def to_s(*args, **options, &) #

[View source]

Macro Detail

macro method_missing(call) #

[View source]