class Discord::Context
- Discord::Context
- Reference
- Object
Overview
A Context
instance is a container that can be used to store any kind of
class to be later recalled:
class Foo
getter value
def initialize(@value : Int32)
end
end
class Bar
getter value
def initialize(@value : String)
end
end
context = Context.new
context.put Foo.new(1337)
context.put Bar.new("discord")
context[Foo].value # => 1337
context[Bar].value # => "discord"
Defined in:
discordcr-middleware/context.crInstance Method Summary
-
#[](clazz : T.class) : T forall T
Access a stored value by class
-
#put(extension : T) forall T
Store an object in this class.