module Redcord::Attribute::InstanceMethods

Public Instance Methods

hash_tag() click to toggle source
# File lib/redcord/attribute.rb, line 162
def hash_tag
  attr = self.class.class_variable_get(:@@shard_by_attribute)

  return nil if attr.nil?

  # A blank hash tag would cause MOVED error in cluster mode
  tag = send(attr)
  default_tag = '__redcord_hash_tag_null__'

  if tag == default_tag
    raise Redcord::InvalidAttribute, "#{attr}=#{default_tag} conflicts with default hash_tag value"
  end

  "{#{tag || default_tag}}"
end