Class: RDB::ReaderState

Inherits:
Object
  • Object
show all
Defined in:
lib/rdb/reader-state.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(callbacks = nil) ⇒ ReaderState

Returns a new instance of ReaderState.



7
8
9
# File 'lib/rdb/reader-state.rb', line 7

def initialize(callbacks = nil)
  @callbacks = callbacks || EmptyCallbacks.new
end

Instance Attribute Details

#callbacksObject (readonly)

Returns the value of attribute callbacks.



5
6
7
# File 'lib/rdb/reader-state.rb', line 5

def callbacks
  @callbacks
end

#databaseObject

Returns the value of attribute database.



3
4
5
# File 'lib/rdb/reader-state.rb', line 3

def database
  @database
end

#infoObject

Returns the value of attribute info.



3
4
5
# File 'lib/rdb/reader-state.rb', line 3

def info
  @info
end

#keyObject

Returns the value of attribute key.



4
5
6
# File 'lib/rdb/reader-state.rb', line 4

def key
  @key
end

#key_expirationObject

Returns the value of attribute key_expiration.



4
5
6
# File 'lib/rdb/reader-state.rb', line 4

def key_expiration
  @key_expiration
end

#key_type_idObject

Returns the value of attribute key_type_id.



4
5
6
# File 'lib/rdb/reader-state.rb', line 4

def key_type_id
  @key_type_id
end

Instance Method Details

#key_expires?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/rdb/reader-state.rb', line 11

def key_expires?
  !@key_expiration.nil?
end

#key_typeObject



15
16
17
18
19
20
21
22
23
# File 'lib/rdb/reader-state.rb', line 15

def key_type
  case @key_type_id
  when Type::STRING then :string
  when Type::SET, Type::SET_INTSET then :set
  when Type::LIST, Type::LIST_ZIPLIST then :list
  when Type::ZSET, Type::ZSET_ZIPLIST then :sortedset
  when Type::HASH, Type::HASH_ZIPMAP, Type::HASH_ZIPLIST then :hash
  end
end