Class: Refile::Memory::Backend

Inherits:
Object
  • Object
show all
Extended by:
BackendMacros
Defined in:
lib/refile/memory.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(max_size: nil, hasher: Refile::RandomHasher.new) ⇒ Backend

Returns a new instance of Backend.


12
13
14
15
16
# File 'lib/refile/memory.rb', line 12

def initialize(max_size: nil, hasher: Refile::RandomHasher.new)
  @hasher = hasher
  @max_size = max_size
  @store = {}
end

Instance Attribute Details

#directoryObject (readonly)

Returns the value of attribute directory


8
9
10
# File 'lib/refile/memory.rb', line 8

def directory
  @directory
end

#max_sizeObject (readonly)

Returns the value of attribute max_size


10
11
12
# File 'lib/refile/memory.rb', line 10

def max_size
  @max_size
end

Instance Method Details

#clear!(confirm = nil) ⇒ Object

Raises:

  • (Refile::Confirm)

50
51
52
53
# File 'lib/refile/memory.rb', line 50

def clear!(confirm = nil)
  raise Refile::Confirm unless confirm == :confirm
  @store = {}
end