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, #reverse, #to_a, #to_hash, #values

Constructor Details

#initialize(*args, &block) ⇒ OrderedHash

Returns a new instance of OrderedHash.



141
142
143
144
# File 'lib/cassandra/ordered_hash.rb', line 141

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

Instance Method Details

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



151
152
153
154
# File 'lib/cassandra/ordered_hash.rb', line 151

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

#clearObject



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

def clear
  @timestamps.clear
  super
end

#delete(key) ⇒ Object



156
157
158
159
# File 'lib/cassandra/ordered_hash.rb', line 156

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

#delete_if(&block) ⇒ Object



161
162
163
164
# File 'lib/cassandra/ordered_hash.rb', line 161

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

#initialize_copy(other) ⇒ Object



146
147
148
149
# File 'lib/cassandra/ordered_hash.rb', line 146

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

#inspectObject



191
192
193
# File 'lib/cassandra/ordered_hash.rb', line 191

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

#reject!(&block) ⇒ Object



166
167
168
169
# File 'lib/cassandra/ordered_hash.rb', line 166

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

#replace(other) ⇒ Object



186
187
188
189
# File 'lib/cassandra/ordered_hash.rb', line 186

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

#shiftObject



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

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

#timestampsObject



171
172
173
# File 'lib/cassandra/ordered_hash.rb', line 171

def timestamps
  @timestamps.dup
end