Module: Redcord::Attribute

Extended by:
T::Helpers, T::Sig
Defined in:
lib/redcord/attribute.rb

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Constant Summary collapse

RangeIndexType =

We implicitly determine what should be a range index on Redis based on Ruby type.

T.type_alias {
  T.any(
    Float,
    Integer,
    NilClass,
    Numeric,
    Time,
  )
}
CustomIndexType =

Implicitly determine what data type can be a used in custom index on Redis based on Ruby type. Custom index currently supports positive integers with up to 19 characters in decimal notation, will raise error in Lua if bigger numbers are used.

T.type_alias {
  T.any(
    Integer,
    Time,
  )
}

Class Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



35
36
37
38
39
40
41
42
43
# File 'lib/redcord/attribute.rb', line 35

def self.included(klass)
  klass.extend(ClassMethods)
  klass.include(InstanceMethods)
  klass.class_variable_set(:@@index_attributes, Set.new)
  klass.class_variable_set(:@@range_index_attributes, Set.new)
  klass.class_variable_set(:@@custom_index_attributes, Hash.new { |h, k| h[k] = [] })
  klass.class_variable_set(:@@ttl, nil)
  klass.class_variable_set(:@@shard_by_attribute, nil)
end