module Cattri::Dsl

def cattri(name, value = nil, **options, &block)

Returns:
  • (Array) - the defined methods

Other tags:
    Yield: - optional block to lazily evaluate the attribute’s default value

Options Hash: (**options)
  • :visibility (Symbol) -- the visibility for generated methods (`:public`, `:protected`, `:private`)
  • :expose (Symbol) -- whether to expose `:read`, `:write`, `:read_write`, or `:none`
  • :predicate (Boolean) -- whether to define a predicate method
  • :final (Boolean) -- whether the attribute is write-once
  • :scope (Boolean) -- whether this is a class-level (:class) or instance-level (:instance) attribute

Parameters:
  • options (Hash) -- additional attribute configuration
  • value (Object, nil) -- optional static value or default
  • name (Symbol, String) -- the attribute name
def cattri(name, value = nil, **options, &block)
  options = { visibility: __cattri_visibility }.merge(options) # steep:ignore
  attribute_registry.define_attribute(name, value, **options, &block) # steep:ignore
end

def final_cattri(name, value, **options, &block)

Returns:
  • (Array) - the defined methods

Other tags:
    Yield: - optional block to lazily evaluate the default

Options Hash: (**options)
  • :visibility (Symbol) -- the visibility for generated methods (`:public`, `:protected`, `:private`)
  • :expose (Symbol) -- whether to expose `:read`, `:write`, `:read_write`, or `:none`
  • :predicate (Boolean) -- whether to define a predicate method
  • :final (Boolean) -- whether the attribute is write-once
  • :scope (Boolean) -- whether this is a class-level (:class) or instance-level (:instance) attribute

Parameters:
  • options (Hash) -- additional attribute configuration
  • value (Object, nil) -- static or lazy default value
  • name (Symbol, String) -- the attribute name
def final_cattri(name, value, **options, &block)
  cattri(name, value, **options.merge(final: true), &block) # steep:ignore
end