Module: FSDB::DatabaseDebuggable

Defined in:
lib/fsdb/util.rb

Overview

Include this module in your database class, or extend your database object with it to enable checking of:

  • use of valid paths

Instance Method Summary collapse

Instance Method Details

#browse(path, *args, &block) ⇒ Object

:nodoc:



158
159
160
161
# File 'lib/fsdb/util.rb', line 158

def browse(path, *args, &block) # :nodoc:
  must_be_valid(path)
  super(path, *args, &block)
end

#delete(path, *args, &block) ⇒ Object

:nodoc:



178
179
180
181
# File 'lib/fsdb/util.rb', line 178

def delete(path, *args, &block) # :nodoc:
  must_be_valid(path)
  super(path, *args, &block)
end

#edit(path, *args, &block) ⇒ Object

:nodoc:



163
164
165
166
# File 'lib/fsdb/util.rb', line 163

def edit(path, *args, &block) # :nodoc:
  must_be_valid(path)
  super(path, *args, &block)
end

#fetch(path, *args, &block) ⇒ Object

:nodoc:



183
184
185
186
# File 'lib/fsdb/util.rb', line 183

def fetch(path, *args, &block) # :nodoc:
  must_be_valid(path)
  super(path, *args, &block)
end

#insert(path, *args, &block) ⇒ Object

:nodoc:



173
174
175
176
# File 'lib/fsdb/util.rb', line 173

def insert(path, *args, &block) # :nodoc:
  must_be_valid(path)
  super(path, *args, &block)
end

#must_be_valid(path) ⇒ Object

Raises PathUtilities::InvalidPathError unless path is valid, in the sense of #valid?.



151
152
153
154
155
156
# File 'lib/fsdb/util.rb', line 151

def must_be_valid(path)
  unless valid?(path)
    raise PathUtilities::InvalidPathError,
          "DebugDatabase noticed that #{path} is not valid."
  end
end

#replace(path, *args, &block) ⇒ Object

:nodoc:



168
169
170
171
# File 'lib/fsdb/util.rb', line 168

def replace(path, *args, &block) # :nodoc:
  must_be_valid(path)
  super(path, *args, &block)
end