module Cattri::Introspection::ClassMethods
def attribute(name)
-
(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)
-
(Boolean)
-
Parameters:
-
name
(Symbol, String
) -- the attribute name
def attribute_defined?(name) !!attribute(name) end
def attribute_definitions(with_ancestors: false)
-
(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
-
(Hash{Symbol => Set
-})
def attribute_methods context.defined_methods # steep:ignore end
def attribute_source(name)
-
(Module, nil)
-
Parameters:
-
name
(Symbol, String
) -- the attribute name
def attribute_source(name) attribute(name)&.defined_in end
def attributes(with_ancestors: false)
-
(Array
-)
Parameters:
-
with_ancestors
(Boolean
) --
def attributes(with_ancestors: false) attribute_registry.defined_attributes(with_ancestors: with_ancestors).keys # steep:ignore end