class Bplist::Any

Defined in:

bplist/any.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(raw : Type) #

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


[View source]

Class Method Detail

def self.convert(value : _) : Bplist::Any #

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


[View source]

Instance Method Detail

def ==(other : Bplist::Any) #

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


[View source]
def ==(other) #

Returns true if the raw object is equal to other.


[View source]
def [](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.


[View source]
def [](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.


[View source]
def []?(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.


[View source]
def []?(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.


[View source]
def as_a : Array(Bplist::Any) #

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


[View source]
def as_a? : Array(Bplist::Any) | Nil #

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


[View source]
def as_f : Float64 #

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


[View source]
def as_f32 : Float32 #

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


[View source]
def as_f32? : Float32 | Nil #

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


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

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


[View source]
def as_h : Hash(String, Bplist::Any) #

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


[View source]
def as_i : Int32 #

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


[View source]
def as_i64 : Int64 #

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


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

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


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

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


[View source]
def as_s : String #

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


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

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


[View source]
def dig(index_or_key : String | Int, *subkeys) : Bplist::Any #

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


[View source]
def 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.


[View source]
def hash(hasher) #
Description copied from class Reference

See Object#hash(hasher)


[View source]
def inspect(io : IO) : Nil #
Description copied from class Reference

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>

[View source]
def pretty_print(pp) #

[View source]
def raw : Type #

Returns the raw underlying value.


[View source]
def to_s(io : IO) : Nil #
Description copied from class Reference

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>

[View source]