Module: Attributor::Type
- Extended by:
- ActiveSupport::Concern
- Included in:
- BigDecimal, Boolean, Class, FieldSelector, Numeric, Object, Polymorphic, Regexp, String, Symbol, Tempfile, Temporal, URI
- Defined in:
- lib/attributor/type.rb
Overview
It is the abstract base class to hold an attribute, both a leaf and a container (hash/Array…) TODO: should this be a mixin since it is an abstract class?
Defined Under Namespace
Modules: ClassMethods
Class Attribute Summary collapse
-
._memoized_collection_classes ⇒ Object
Returns the value of attribute _memoized_collection_classes.
Class Method Summary collapse
- .get_memoized_collection_class(member_class, collection_type = Attributor::Collection) ⇒ Object
- .set_memoized_collection_class(klass, member_class, collection_type = Attributor::Collection) ⇒ Object
Class Attribute Details
._memoized_collection_classes ⇒ Object
Returns the value of attribute _memoized_collection_classes.
25 26 27 |
# File 'lib/attributor/type.rb', line 25 def _memoized_collection_classes @_memoized_collection_classes end |
Class Method Details
.get_memoized_collection_class(member_class, collection_type = Attributor::Collection) ⇒ Object
26 27 28 29 |
# File 'lib/attributor/type.rb', line 26 def get_memoized_collection_class(member_class, collection_type=Attributor::Collection) # No need to serialize on read, Ruby will ensure we can properly read what's there, even if it's being written _memoized_collection_classes.dig(member_class,collection_type) end |
.set_memoized_collection_class(klass, member_class, collection_type = Attributor::Collection) ⇒ Object
30 31 32 33 34 |
# File 'lib/attributor/type.rb', line 30 def set_memoized_collection_class(klass, member_class, collection_type=Attributor::Collection) @_memoized_collection_classes_mutex.synchronize do _memoized_collection_classes[member_class][collection_type] = klass end end |