Class: Conflow::Redis::RawValueField Private

Inherits:
Field
  • Object
show all
Defined in:
lib/conflow/redis/raw_value_field.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Represents single value (Redis String). Values are not serialized

Instance Attribute Summary

Attributes inherited from Field

#key

Instance Method Summary collapse

Methods inherited from Field

#initialize

Constructor Details

This class inherits a constructor from Conflow::Redis::Field

Instance Method Details

#==(other) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns true if equal.



21
22
23
24
25
26
27
# File 'lib/conflow/redis/raw_value_field.rb', line 21

def ==(other)
  case other
  when String, Symbol then value == other.to_s
  when RawValueField  then key == other.key || to_s == other.to_s
  else super
  end
end

#overwrite(value) ⇒ String

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns Redis response.



10
11
12
# File 'lib/conflow/redis/raw_value_field.rb', line 10

def overwrite(value)
  command :set, [key, value]
end

#to_sString? Also known as: to_str

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns String representation of value.



15
16
17
# File 'lib/conflow/redis/raw_value_field.rb', line 15

def to_s
  value&.to_s
end

#valueObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns Value present in Redis.



30
31
32
# File 'lib/conflow/redis/raw_value_field.rb', line 30

def value
  command(:get, [key])
end