class Cattri::Attribute

def initialize(name, defined_in:, **options, &transformer)

Parameters:
  • transformer (Proc) -- optional block used to coerce/validate assigned values
  • options (Hash) -- configuration options
  • defined_in (Module) -- the class or module where this attribute is defined
  • name (Symbol, String) -- the attribute name

Options Hash: (**options)
  • :scope (Boolean) -- whether the attribute is class-level (internally mapped to :class_attribute)
def initialize(name, defined_in:, **options, &transformer)
  @options = Cattri::AttributeOptions.new(name, transformer: transformer, **options)
  @defined_in = defined_in
end