class KDL::Value
Defined in:
kdl/value.crConstructors
Instance Method Summary
-
#==(other : KDL::Value)
Returns
true
if bothself
and other's value object are equal. -
#==(other)
Returns
true
if the value object is equal to other. -
#as_bool : Bool
Checks that the underlying value is
Bool
, and returns its value. -
#as_bool? : Bool | Nil
Checks that the underlying value is
Bool
, and returns its value. -
#as_f : Float64
Checks that the underlying value is
Float
(orInt
), and returns its value as anFloat64
. -
#as_f32 : Float32
Checks that the underlying value is
Float
(orInt
), and returns its value as anFloat32
. -
#as_f32? : Float32 | Nil
Checks that the underlying value is
Float
(orInt
), and returns its value as anFloat32
. -
#as_f? : Float64 | Nil
Checks that the underlying value is
Float
(orInt
), and returns its value as anFloat64
. -
#as_i : Int32
Checks that the underlying value is
Int
, and returns its value as anInt32
. -
#as_i64 : Int64
Checks that the underlying value is
Int
, and returns its value as anInt64
. -
#as_i64? : Int64 | Nil
Checks that the underlying value is
Int
, and returns its value as anInt64
. -
#as_i? : Int32 | Nil
Checks that the underlying value is
Int
, and returns its value as anInt32
. -
#as_nil : Nil
Checks that the underlying value is
Nil
, and returnsnil
. -
#as_s : String
Checks that the underlying value is
String
, and returns its value. -
#as_s? : String | Nil
Checks that the underlying value is
String
, and returns its value. - #as_type(type : String | Nil)
-
#hash(hasher)
See
Object#hash(hasher)
-
#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.
-
#to_s(io : IO) : Nil
Appends a short String representation of this object which includes its class name and its object address.
- #type : String | Nil
- #type=(type : String | Nil)
-
#value : Type
Returns the raw underlying value.
-
#value=(value : Type)
Returns the raw underlying value.
Instance methods inherited from class Reference
==(other : KDL::Value)
==
Instance methods inherited from class Object
===(other : KDL::Value)
===
Constructor Detail
Instance Method Detail
Checks that the underlying value is Bool
, and returns its value.
Raises otherwise.
Checks that the underlying value is Bool
, and returns its value.
Returns nil
otherwise.
Checks that the underlying value is Float
(or Int
), and returns its value as an Float64
.
Raises otherwise.
Checks that the underlying value is Float
(or Int
), and returns its value as an Float32
.
Raises otherwise.
Checks that the underlying value is Float
(or Int
), and returns its value as an Float32
.
Returns nil
otherwise.
Checks that the underlying value is Float
(or Int
), and returns its value as an Float64
.
Returns nil
otherwise.
Checks that the underlying value is Int
, and returns its value as an Int32
.
Raises otherwise.
Checks that the underlying value is Int
, and returns its value as an Int64
.
Raises otherwise.
Checks that the underlying value is Int
, and returns its value as an Int64
.
Returns nil
otherwise.
Checks that the underlying value is Int
, and returns its value as an Int32
.
Returns nil
otherwise.
Checks that the underlying value is String
, and returns its value.
Raises otherwise.
Checks that the underlying value is String
, and returns its value.
Returns nil
otherwise.
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>