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.



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

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

Instance Method Details

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



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

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

#clearObject



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

def clear
  @timestamps.clear
  super
end

#delete(key) ⇒ Object



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

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

#delete_if(&block) ⇒ Object



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

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

#initialize_copy(other) ⇒ Object



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

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

#inspectObject



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

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

#reject!(&block) ⇒ Object



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

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

#replace(other) ⇒ Object



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

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

#shiftObject



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

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

#timestampsObject



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

def timestamps
  @timestamps.dup
end