Class: Cassandra::OrderedHash

Inherits:
OrderedHashInt show all
Defined in:
lib/cassandra/ordered_hash.rb

Overview

:nodoc:

Instance Method Summary collapse

Methods inherited from OrderedHashInt

[], #each, #each_key, #each_value, #keys, #merge, #merge!, #reject, #to_a, #to_hash, #values

Constructor Details

#initialize(*args, &block) ⇒ OrderedHash

Returns a new instance of OrderedHash.



134
135
136
137
# File 'lib/cassandra/ordered_hash.rb', line 134

def initialize(*args, &block)
  @timestamps = Hash.new
  super
end

Instance Method Details

#[]=(key, value, timestamp = nil) ⇒ Object



144
145
146
147
# File 'lib/cassandra/ordered_hash.rb', line 144

def []=(key, value, timestamp = nil)
  @timestamps[key] = timestamp
  super(key, value)
end

#clearObject



168
169
170
171
# File 'lib/cassandra/ordered_hash.rb', line 168

def clear
  @timestamps.clear
  super
end

#delete(key) ⇒ Object



149
150
151
152
# File 'lib/cassandra/ordered_hash.rb', line 149

def delete(key)
  @timestamps.delete(key)
  super
end

#delete_if(&block) ⇒ Object



154
155
156
157
# File 'lib/cassandra/ordered_hash.rb', line 154

def delete_if(&block)
  @timestamps.delete_if(&block)
  super
end

#initialize_copy(other) ⇒ Object



139
140
141
142
# File 'lib/cassandra/ordered_hash.rb', line 139

def initialize_copy(other)
  @timestamps = other.timestamps
  super
end

#inspectObject



184
185
186
# File 'lib/cassandra/ordered_hash.rb', line 184

def inspect
  "#<OrderedHash #{super}\n#{@timestamps.inspect}>"
end

#reject!(&block) ⇒ Object



159
160
161
162
# File 'lib/cassandra/ordered_hash.rb', line 159

def reject!(&block)
  @timestamps.reject!(&block)
  super
end

#replace(other) ⇒ Object



179
180
181
182
# File 'lib/cassandra/ordered_hash.rb', line 179

def replace(other)
  @timestamps = other.timestamps
  super
end

#shiftObject



173
174
175
176
177
# File 'lib/cassandra/ordered_hash.rb', line 173

def shift
  k, v = super
  @timestamps.delete(k)
  [k, v]
end

#timestampsObject



164
165
166
# File 'lib/cassandra/ordered_hash.rb', line 164

def timestamps
  @timestamps.dup
end