UUID
Inherits Comparable < Struct < Value < Object
Represents a UUID (Universally Unique IDentifier).
NOTE: To use UUID, you must explicitly import it with require "uuid"
Constructors
Creates UUID from YAML using YAML::ParseContext.
NOTE: require "cryaml/uuid" is required to opt-in to this feature.
require "cryaml"
require "uuid"
require "cryaml/uuid"
class Example
include YAML::Serializable
property id : UUID
end
example = Example.from_yaml("id: 50a11da6-377b-4bdf-b9f0-076f9db61c93")
example.id # => UUID(50a11da6-377b-4bdf-b9f0-076f9db61c93)
Instance methods
to_yaml(yaml : YAML::Nodes::Builder)
Returns UUID as YAML value.
NOTE: require "cryaml/uuid" is required to opt-in to this feature.
uuid = UUID.new("50a11da6-377b-4bdf-b9f0-076f9db61c93")
uuid.to_yaml # => "--- 50a11da6-377b-4bdf-b9f0-076f9db61c93\n"