module Crinja::Object::Auto

Overview

When this module is included, it defines a #crinja_attribute method (see Crinja::Object for its purpose) with dynamic accessors to all methods exposed using an annotation.

Example:

@[Crinja::Attributes(expose: [name, age])]
class User
  include Crinja::Object::Auto

  property name : String
  property dob : Time

  def initialize(@name, @dob)
  end

  def age
    (Time.now - @dob).year
  end
end

Included Modules

Direct including types

Defined in:

object.cr

Instance Method Summary

Instance Method Detail

def crinja_attribute(attr : Crinja::Value) : Crinja::Value #

[View source]