Module: Dradis::Plugins::Base::ClassMethods

Defined in:
lib/dradis/plugins/base.rb

Instance Method Summary collapse

Instance Method Details

#description(new_description) ⇒ Object



21
22
23
# File 'lib/dradis/plugins/base.rb', line 21

def description(new_description)
  @description = new_description
end

#disable!Object



54
55
56
57
# File 'lib/dradis/plugins/base.rb', line 54

def disable!
  self.settings.update_settings(enabled: false)
  Dradis::Plugins::clear_enabled_list
end

#enable!Object



49
50
51
52
# File 'lib/dradis/plugins/base.rb', line 49

def enable!
  self.settings.update_settings(enabled: true)
  Dradis::Plugins::clear_enabled_list
end

#enabled?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/dradis/plugins/base.rb', line 45

def enabled?
  ActiveRecord::Type::Boolean.new.cast(self.settings.enabled)
end

#plugin_descriptionObject



25
26
27
# File 'lib/dradis/plugins/base.rb', line 25

def plugin_description
  @description ||= "This plugin doesn't provide a :description"
end

#plugin_nameObject



29
30
31
# File 'lib/dradis/plugins/base.rb', line 29

def plugin_name
  @plugin_name ||= self.name.split('::')[-2].underscore.to_sym
end

#provides(*list) ⇒ Object



33
34
35
36
37
38
39
# File 'lib/dradis/plugins/base.rb', line 33

def provides(*list)
  @features = list
  if list.include?(:upload)
    include Dradis::Plugins::Upload::Base
    include Dradis::Plugins::Mappings::Base
  end
end

#provides?(feature) ⇒ Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/dradis/plugins/base.rb', line 41

def provides?(feature)
  @features.include?(feature)
end