class Marten::Template::Object::Enum

Overview

Allows to expose enum values in templates contexts.

This class serves as a "wrapper" for a real enum value, containing both its "value" and "name". It enables smooth manipulation of such enum values within a template runtime. Ordinary enum values cannot be used directly in templates because Enum be added to union types, hence why this class is necessary.

Included Modules

Defined in:

marten/template/object/enum.cr

Constructors

Instance Method Summary

Macros inherited from module Marten::Template::Object

template_attributes(*names) template_attributes

Constructor Detail

def self.new(enum_class_name : String, enum_value_names : Array(String), name : String, value : Int64) #

[View source]

Instance Method Detail

def ==(other : self) #
Description copied from class Reference

Returns true if this reference is the same as other. Invokes same?.


[View source]
def enum_class_name : String #

[View source]
def enum_value_names : Array(String) #

[View source]
def name : String #

[View source]
def value : Int64 #

[View source]