module Cattri::Introspection::ClassMethods

def attribute(name)

Returns:
  • (Cattri::Attribute, nil) -

Parameters:
  • name (Symbol, String) -- the attribute name
def attribute(name)
  attribute_registry.defined_attributes(with_ancestors: true)[name.to_sym] # steep:ignore
end

def attribute_defined?(name)

Returns:
  • (Boolean) -

Parameters:
  • name (Symbol, String) -- the attribute name
def attribute_defined?(name)
  !!attribute(name)
end

def attribute_definitions(with_ancestors: false)

Returns:
  • (Hash{Symbol => Cattri::Attribute}) -

Parameters:
  • with_ancestors (Boolean) --
def attribute_definitions(with_ancestors: false)
  attribute_registry.defined_attributes(with_ancestors: with_ancestors) # steep:ignore
end

def attribute_methods

Returns:
  • (Hash{Symbol => Set}) -
def attribute_methods
  context.defined_methods # steep:ignore
end

def attribute_source(name)

Returns:
  • (Module, nil) -

Parameters:
  • name (Symbol, String) -- the attribute name
def attribute_source(name)
  attribute(name)&.defined_in
end

def attributes(with_ancestors: false)

Returns:
  • (Array) -

Parameters:
  • with_ancestors (Boolean) --
def attributes(with_ancestors: false)
  attribute_registry.defined_attributes(with_ancestors: with_ancestors).keys # steep:ignore
end