class

Bplist::Any

Inherits Reference < Object

Constructors

new(raw : Type)

Creates a Bplist::Any that wraps the given value.

Source

Class methods

convert(value : _) : Bplist::Any

Method to convert a value to the Bplist::Any type

Source

Instance methods

==(other : Bplist::Any)

Returns true if both self and other's raw object are equal.

Source
==(other)

Returns true if the raw object is equal to other.

Source
[](index : Int) : Bplist::Any

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

Source
[](key : String) : Bplist::Any

Assumes the underlying value is a Hash and returns the element with the given key. Raises if the underlying value is not a Hash.

Source
[]?(index : Int) : Bplist::Any | 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.

Source
[]?(key : String) : Bplist::Any | Nil

Assumes the underlying value is a Hash and returns the element with the given key, or nil if the key is not present. Raises if the underlying value is not a Hash.

Source
as_a

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

Source
as_a?

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

Source
as_bytes

Checks that the underlying value is Slice(UInt8), and returns its value. Raises otherwise.

Source
as_bytes?

Checks that the underlying value is Slice(UInt8), and returns its value. Returns nil otherwise.

Source
as_f

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

Source
as_f32

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

Source
as_f32?

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

Source
as_f?

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

Source
as_h

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

Source
as_i

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

Source
as_i64

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

Source
as_i64?

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

Source
as_i?

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

Source
as_s

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

Source
as_s?

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

Source
dig(index_or_key : String | Int, *subkeys) : Bplist::Any

Traverses the depth of a structure and returns the value, otherwise raises.

Source
dig?(index_or_key : String | Int, *subkeys) : Bplist::Any | Nil

Traverses the depth of a structure and returns the value. Returns nil if not found.

Source
hash(hasher)

See Object#hash(hasher)

Source
inspect(io : IO) : Nil

Appends a String representation of this object which includes its class name, its object address and the values of all instance variables.

class Person
  def initialize(@name : String, @age : Int32)
  end
end

Person.new("John", 32).inspect # => #<Person:0x10fd31f20 @name="John", @age=32>
Source
pretty_print(pp)
Source
raw

Returns the raw underlying value.

Source
to_a

Converts the Bplist::Any to a regular Crystal Array that can be modified. Recursively converts nested Bplist::Any objects to their native types.

Source
to_any

Converts the Bplist::Any to its native Crystal type. Recursively converts nested Bplist::Any objects to their native types.

Source
to_h

Converts the Bplist::Any to a regular Crystal Hash that can be modified. Recursively converts nested Bplist::Any objects to their native types.

Source
to_s(io : IO) : Nil

Appends a short String representation of this object which includes its class name and its object address.

class Person
  def initialize(@name : String, @age : Int32)
  end
end

Person.new("John", 32).to_s # => #<Person:0x10a199f20>
Source

Nested types