Class: Wpxf::Models::LootItem

Inherits:
Sequel::Model
  • Object
show all
Defined in:
lib/wpxf/models/loot_item.rb

Overview

A loot item acquired from a target.

Instance Method Summary collapse

Instance Method Details

#before_destroyObject



31
32
33
34
# File 'lib/wpxf/models/loot_item.rb', line 31

def before_destroy
  super
  FileUtils.rm path if File.exist?(path)
end

#validateObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/wpxf/models/loot_item.rb', line 13

def validate
  super

  validates_presence :host
  validates_presence :port
  validates_presence :path

  validates_numeric :port
  validates_type String, :path, allow_nil: true
  validates_type String, :type, allow_nil: false
  validates_type String, :notes, allow_nil: true

  validates_max_length 500, :path
  validates_max_length 250, :host
  validates_max_length 50, :type
  validates_max_length 100, :notes, allow_nil: true
end