class

KrikriJinja::HostObject

Inherits Reference < Object

A host-defined value type (a date, a duration, ...) taking part in templates through Python-style hooks. Every hook has a default that means "not supported", so a host implements only what its type does.

Instance methods

binary_op(op : String, other : AnyValue, reflected : Bool) : AnyValue | Nil

A binary arithmetic operator with other. reflected is true when this object is the right-hand operand (Python's radd and friends). Nil means unsupported for that operand.

Source
compare(other : AnyValue) : Int32 | Nil

Ordering against other (-1, 0, 1), or nil when incomparable.

Source
get_attr(name : String) : AnyValue | Nil

Attribute or method lookup (value.days, value.strftime(...)); nil when the object has no such attribute.

Source
repr

Python's repr(), used inside list/dict output. Defaults to str().

Source
to_json_any

How the value crosses into JSON (tojson, host conversions).

Source
to_s(io : IO) : Nil

Python's str(): what {{ value }} renders.

Source
truthy?
Source