Class: Rails::On::Sorbet::CurrentAttributes
- Inherits:
-
ActiveSupport::CurrentAttributes
- Object
- ActiveSupport::CurrentAttributes
- Rails::On::Sorbet::CurrentAttributes
- Defined in:
- lib/rails/on/sorbet/current_attributes.rb
Overview
Shim for ActiveSupport::CurrentAttributes to support sorbet
Defined Under Namespace
Classes: Attribute
Class Method Summary collapse
-
.attribute(*names, type: nil, doc: nil, default: ::ActiveSupport::CurrentAttributes::NOT_SET) ⇒ Object
Declare a new attribute with a sorbet type.
-
.attribute_map ⇒ Object
Get a map with all defined attributes and their types.
Class Method Details
.attribute(*names, type: nil, doc: nil, default: ::ActiveSupport::CurrentAttributes::NOT_SET) ⇒ Object
Declare a new attribute with a sorbet type
: (*Symbol, ?type: untyped, ?doc: String?, ?default: untyped) -> void
39 40 41 42 43 44 |
# File 'lib/rails/on/sorbet/current_attributes.rb', line 39 def attribute(*names, type: nil, doc: nil, default: ::ActiveSupport::CurrentAttributes::NOT_SET) names.each do |name| attribute_map[name] = Attribute.new(name, type, doc) end super(*names, default: default) end |
.attribute_map ⇒ Object
Get a map with all defined attributes and their types
: -> Hash[Symbol, Attribute]
32 33 34 |
# File 'lib/rails/on/sorbet/current_attributes.rb', line 32 def attribute_map @attribute_map ||= {} end |