Module: RDKit::DBCommands::HashCommands

Included in:
RDKit::DBCommands
Defined in:
lib/rdkit/db_commands.rb

Instance Method Summary collapse

Instance Method Details

#hdel(key, field, *more_fields) ⇒ Object



128
129
130
# File 'lib/rdkit/db_commands.rb', line 128

def hdel(key, field, *more_fields)
  db.hdel(key, [field] + more_fields).tap { db.del([key]) if db.hlen(key) == 0 }
end

#hexists(key, field) ⇒ Object



112
113
114
# File 'lib/rdkit/db_commands.rb', line 112

def hexists(key, field)
  db.hexists?(key, field)
end

#hget(key, field) ⇒ Object



108
109
110
# File 'lib/rdkit/db_commands.rb', line 108

def hget(key, field)
  db.hget(key, field)
end

#hkeys(key) ⇒ Object



132
133
134
# File 'lib/rdkit/db_commands.rb', line 132

def hkeys(key)
  db.hkeys(key)
end

#hlen(key) ⇒ Object



116
117
118
# File 'lib/rdkit/db_commands.rb', line 116

def hlen(key)
  db.hlen(key)
end

#hset(key, field, value) ⇒ Object



104
105
106
# File 'lib/rdkit/db_commands.rb', line 104

def hset(key, field, value)
  db.hset(key, field, value)
end

#hstrlen(key, field) ⇒ Object



120
121
122
123
124
125
126
# File 'lib/rdkit/db_commands.rb', line 120

def hstrlen(key, field)
  if str = db.hget(key, field)
    str.bytesize
  else
    0
  end
end

#hvals(key) ⇒ Object



136
137
138
# File 'lib/rdkit/db_commands.rb', line 136

def hvals(key)
  db.hvals(key)
end