module Lucky::Assignable

Direct including types

Defined in:


Constant Summary

ASSIGNS = [] of Nil


Macro Summary

Constructor Detail

def**unused_exposures) #

Macro Detail

macro generate_needy_initializer #

[View source]
macro needs(*type_declarations) #

Declare what a class needs in order to be initialized.

This will declare an instance variable and getter automatically. It will also add arguments to an initialize method at the end of compilation.


class Users::IndexPage < MainLayout
  # This page needs a `User` or it will fail to compile
  # You can access it with `@user` or the getter method `user`
  needs user : User

  # This page can take an optional `ProductQuery`. This means you can
  # Leave `products` off when rendering from an Action.
  needs products : ProductQuery?

  # When using a `Bool` Lucky will generate a method ending with `?`
  # So in this case you can call `should_show_sidebar?` in the page.
  needs should_show_sidebar : Bool = true

[View source]
macro setup_initializer_hook #

[View source]