Exception: FolderStash::Errors::TreeLimitExceededError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/folder_stash/errors/tree_limit_exceeded_error.rb

Overview

Error that is raised when the number of items in a tree has exceeded the maximum number allowed in a tree.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(msg = nil, tree: nil) ⇒ TreeLimitExceededError

Returns a new instance of TreeLimitExceededError.



17
18
19
20
21
22
23
24
25
# File 'lib/folder_stash/errors/tree_limit_exceeded_error.rb', line 17

def initialize(msg = nil, tree: nil)
  @subdirs = tree.subdirectories
  @subdir_limit = tree.folder_limit
  @tree_limit = tree.tree_limit
  msg ||= 'The storage tree has reached the limit of allowed items:'\
          " #{subdir_limit} items in #{subdirs} subdirectories"\
          " (#{tree_limit} allowd items in total)."
  super msg
end

Instance Attribute Details

#subdir_limitObject (readonly)

Number of items allowed in a subdirectory.



12
13
14
# File 'lib/folder_stash/errors/tree_limit_exceeded_error.rb', line 12

def subdir_limit
  @subdir_limit
end

#subdirsObject (readonly)

Number of subdirectories in a given path (branch) of the tree.



9
10
11
# File 'lib/folder_stash/errors/tree_limit_exceeded_error.rb', line 9

def subdirs
  @subdirs
end

#tree_limitObject (readonly)

Total number of items allowed in a tree.



15
16
17
# File 'lib/folder_stash/errors/tree_limit_exceeded_error.rb', line 15

def tree_limit
  @tree_limit
end