Class: RedBlocks::InstantSet
Instance Attribute Summary collapse
-
#suffix ⇒ Object
readonly
Returns the value of attribute suffix.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Attributes inherited from Set
Instance Method Summary collapse
- #cache_time ⇒ Object
- #get ⇒ Object
-
#initialize(value) ⇒ InstantSet
constructor
A new instance of InstantSet.
- #key_suffix ⇒ Object
Methods inherited from Set
#disabled?, #expiration_time, #expression, #ids, #key, key_pattern, #label, #size, #update!, #update_if_disabled!
Methods included from SetOptimizer
Methods included from SetUtils
included, #joined_key, #normalize_entries, #validate_array_entry, #validate_entries!
Constructor Details
#initialize(value) ⇒ InstantSet
Returns a new instance of InstantSet.
5 6 7 8 9 10 11 12 |
# File 'lib/red_blocks/instant_set.rb', line 5 def initialize(value) unless value.is_a?(Array) raise TypeError.new("Expect value as Array, but got #{ids_or_ids_with_scores.class}") end @value = value @suffix = Digest::SHA2.hexdigest value.sort.uniq.join(",") end |
Instance Attribute Details
#suffix ⇒ Object (readonly)
Returns the value of attribute suffix.
3 4 5 |
# File 'lib/red_blocks/instant_set.rb', line 3 def suffix @suffix end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
3 4 5 |
# File 'lib/red_blocks/instant_set.rb', line 3 def value @value end |
Instance Method Details
#cache_time ⇒ Object
14 15 16 |
# File 'lib/red_blocks/instant_set.rb', line 14 def cache_time 0 end |
#get ⇒ Object
18 19 20 |
# File 'lib/red_blocks/instant_set.rb', line 18 def get value end |
#key_suffix ⇒ Object
22 23 24 |
# File 'lib/red_blocks/instant_set.rb', line 22 def key_suffix suffix end |