struct NBT::Tag
- NBT::Tag
- Struct
- Value
- Object
Defined in:
nbt.crConstructors
Instance Method Summary
-
#==(other : self)
Returns
trueif bothselfand other's raw object are equal. -
#==(other)
Returns
trueif the raw object is equal to other. -
#[](index_or_key) : self
Assumes the underlying value is an
ArrayorHashand returns the element at the given index_or_key. -
#[]?(index_or_key) : self | Nil
Assumes the underlying value is an
ArrayorHashand returns the element at the given index_or_key, ornilif out of bounds or the key is missing. -
#as_a : Array(self)
Checks that the underlying value is
Array(self), and returns its value. -
#as_a? : Array(self) | Nil
Checks that the underlying value is
Array(self), and returns its value. -
#as_b : Int8
Checks that the underlying value is
Int8, and returns its value. -
#as_b? : Int8 | Nil
Checks that the underlying value is
Int8, and returns its value. -
#as_b_a : Array(Int8)
Checks that the underlying value is
Array(Int8), and returns its value. -
#as_b_a? : Array(Int8) | Nil
Checks that the underlying value is
Array(Int8), and returns its value. -
#as_d : Float64
Checks that the underlying value is
Float64, and returns its value. -
#as_d? : Float64 | Nil
Checks that the underlying value is
Float64, and returns its value. -
#as_f : Float32
Checks that the underlying value is
Float32, and returns its value. -
#as_f? : Float32 | Nil
Checks that the underlying value is
Float32, and returns its value. -
#as_h : Hash(String, self)
Checks that the underlying value is
Hash(String, self), and returns its value. -
#as_h? : Hash(String, self) | Nil
Checks that the underlying value is
Hash(String, self), and returns its value. -
#as_i : Int32
Checks that the underlying value is
Int32, and returns its value. -
#as_i? : Int32 | Nil
Checks that the underlying value is
Int32, and returns its value. -
#as_i_a : Array(Int32)
Checks that the underlying value is
Array(Int32), and returns its value. -
#as_i_a? : Array(Int32) | Nil
Checks that the underlying value is
Array(Int32), and returns its value. -
#as_long : Int64
Checks that the underlying value is
Int64, and returns its value. -
#as_long? : Int64 | Nil
Checks that the underlying value is
Int64, and returns its value. -
#as_long_a : Array(Int64)
Checks that the underlying value is
Array(Int64), and returns its value. -
#as_long_a? : Array(Int64) | Nil
Checks that the underlying value is
Array(Int64), and returns its value. -
#as_s : NBT::NBTString
Checks that the underlying value is
NBT::NBTString, and returns its value. -
#as_s? : NBT::NBTString | Nil
Checks that the underlying value is
NBT::NBTString, and returns its value. -
#as_short : Int16
Checks that the underlying value is
Int16, and returns its value. -
#as_short? : Int16 | Nil
Checks that the underlying value is
Int16, and returns its value. -
#as_tag_end : Nil
Checks that the underlying value is
Nil, and returns its value. - #clone
-
#dig(index_or_key, *subkeys) : self
Traverses the depth of a structure and returns the value, otherwise raises.
-
#dig?(index_or_key, *subkeys) : self | Nil
Traverses the depth of a structure and returns the value.
- #dup
-
#hash(hasher)
See
Object#hash(hasher) -
#inspect(io : IO) : Nil
Appends this struct's name and instance variables names and values to the given IO.
-
#raw : Type
Returns the raw underlying value, a
Type. -
#size : Int
Assumes the underlying value is an
ArrayorHashand returns its size. - #to_json(json : JSON::Builder)
-
#to_s(io : IO) : Nil
Same as
#inspect(io).
Constructor Detail
Instance Method Detail
Assumes the underlying value is an Array or Hash
and returns the element at the given index_or_key.
Raises if the underlying value is not an Array nor a Hash.
Assumes the underlying value is an Array or Hash and returns the element
at the given index_or_key, or nil if out of bounds or the key is missing.
Raises if the underlying value is not an Array nor a Hash.
Checks that the underlying value is Array(self), and returns its value.
Raises otherwise.
Checks that the underlying value is Array(self), and returns its value.
Returns nil otherwise.
Checks that the underlying value is Int8, and returns its value.
Raises otherwise.
Checks that the underlying value is Int8, and returns its value.
Returns nil otherwise.
Checks that the underlying value is Array(Int8), and returns its value.
Raises otherwise.
Checks that the underlying value is Array(Int8), and returns its value.
Returns nil otherwise.
Checks that the underlying value is Float64, and returns its value.
Raises otherwise.
Checks that the underlying value is Float64, and returns its value.
Returns nil otherwise.
Checks that the underlying value is Float32, and returns its value.
Raises otherwise.
Checks that the underlying value is Float32, and returns its value.
Returns nil otherwise.
Checks that the underlying value is Hash(String, self), and returns its value.
Raises otherwise.
Checks that the underlying value is Hash(String, self), and returns its value.
Returns nil otherwise.
Checks that the underlying value is Int32, and returns its value.
Raises otherwise.
Checks that the underlying value is Int32, and returns its value.
Returns nil otherwise.
Checks that the underlying value is Array(Int32), and returns its value.
Raises otherwise.
Checks that the underlying value is Array(Int32), and returns its value.
Returns nil otherwise.
Checks that the underlying value is Int64, and returns its value.
Raises otherwise.
Checks that the underlying value is Int64, and returns its value.
Returns nil otherwise.
Checks that the underlying value is Array(Int64), and returns its value.
Raises otherwise.
Checks that the underlying value is Array(Int64), and returns its value.
Returns nil otherwise.
Checks that the underlying value is NBT::NBTString, and returns its value.
Raises otherwise.
Checks that the underlying value is NBT::NBTString, and returns its value.
Returns nil otherwise.
Checks that the underlying value is Int16, and returns its value.
Raises otherwise.
Checks that the underlying value is Int16, and returns its value.
Returns nil otherwise.
Checks that the underlying value is Nil, and returns its value.
Raises otherwise.
Traverses the depth of a structure and returns the value, otherwise raises.
Traverses the depth of a structure and returns the value.
Returns nil if not found.
Appends this struct's name and instance variables names and values to the given IO.
struct Point
def initialize(@x : Int32, @y : Int32)
end
end
p1 = Point.new 1, 2
p1.to_s # "Point(@x=1, @y=2)"
p1.inspect # "Point(@x=1, @y=2)"
Assumes the underlying value is an Array or Hash and returns its size.
Raises if the underlying value is not an Array or Hash.