module

Hathor::NestedMacro

Macros

nested(nested_name, **options)

nested macro To achieve nesting like contract.address.street, we think about the nested element as a new nested contract.

  • populates the PROPERTIES hash to a nested element
  • defines @type.id::nested_name < Contract class with yield
  • depending on nilable option
    • casts property name : @type.id::nested_name | Nil
      • defines new_@type.id::nested_name method
    • casts property name : @type.id::nested_name
Source
nested!(name, **options)

shortcut for "nilable: false" option

Source