class

KDL::Value

Inherits Reference < Object

Constructors

new(value : Type, *, type : String | Nil = nil, format : String | Nil = nil, comment : String | Nil = nil)
Source

Instance methods

==(other : KDL::Value)

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

Source
==(other)

Returns true if the value object is equal to other.

Source
as_bool

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

Source
as_bool?

Checks that the underlying value is Bool, 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_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_nil

Checks that the underlying value is Nil, and returns nil. Raises 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
as_type(type : String | Nil)
Source
comment
Source
comment=(comment : String | Nil)
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
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
type
Source
type=(type : String | Nil)
Source
value

Returns the raw underlying value.

Source
value=(value : Type)

Returns the raw underlying value.

Source

Nested types