Module: Familia::Base
Overview
Class Attribute Summary collapse
-
.dump_method ⇒ Object
Returns the value of attribute dump_method.
-
.features ⇒ Object
readonly
Returns the value of attribute features.
-
.load_method ⇒ Object
Returns the value of attribute load_method.
Class Method Summary collapse
Instance Method Summary collapse
-
#generate_id ⇒ Object
-
#to_s ⇒ String
Returns a string representation of the object.
-
#update_expiration(default_expiration: nil) ⇒ nil
Base implementation of update_expiration that maintains API compatibility with the :expiration feature’s implementation.
-
#uuid ⇒ Object
Class Attribute Details
.dump_method ⇒ Object
Returns the value of attribute dump_method.
33 34 35 |
# File 'lib/familia/base.rb', line 33 def dump_method @dump_method end |
.features ⇒ Object (readonly)
Returns the value of attribute features.
32 33 34 |
# File 'lib/familia/base.rb', line 32 def features @features end |
.load_method ⇒ Object
Returns the value of attribute load_method.
33 34 35 |
# File 'lib/familia/base.rb', line 33 def load_method @load_method end |
Class Method Details
Instance Method Details
#generate_id ⇒ Object
61 62 63 64 |
# File 'lib/familia/base.rb', line 61 def generate_id @identifier ||= Familia.generate_id @identifier end |
#to_s ⇒ String
Returns a string representation of the object. Implementing classes are welcome to override this method to provide a more meaningful representation. Using this as a default via super is recommended.
27 28 29 |
# File 'lib/familia/base.rb', line 27 def to_s "#<#{self.class}:0x#{object_id.to_s(16)}>" end |
#update_expiration(default_expiration: nil) ⇒ nil
This is a no-op implementation. Classes that need expiration functionality should include the :expiration feature.
Base implementation of update_expiration that maintains API compatibility with the :expiration feature’s implementation.
This is a no-op implementation that gets overridden by features like :expiration. It accepts an optional default_expiration parameter to maintain interface compatibility with the overriding implementations.
56 57 58 59 |
# File 'lib/familia/base.rb', line 56 def update_expiration(default_expiration: nil) Familia.ld "[update_expiration] Feature not enabled for #{self.class}. Key: #{dbkey} (caller: #{caller(1..1)})" nil end |
#uuid ⇒ Object
66 67 68 69 |
# File 'lib/familia/base.rb', line 66 def uuid @uuid ||= SecureRandom.uuid @uuid end |