Class: Dradis::Plugins::Export::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/dradis/plugins/export/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Base

Returns a new instance of Base.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/dradis/plugins/export/base.rb', line 10

def initialize(args={})
  # Save everything just in case the implementing class needs any of it.
  @options = args

  # Can't use :fetch for :plugin or :default_plugin gets evaluated
  @logger  = args.fetch(:logger, Rails.logger)
  @plugin  = args[:plugin] || default_plugin
  @project = args.key?(:project_id) ? Project.find(args[:project_id]) : nil
  @scope = args.fetch(:scope, :published).to_sym

  @content_service = args.fetch(:content_service, default_content_service)

  post_initialize(args)
end

Instance Attribute Details

#content_serviceObject

Returns the value of attribute content_service.



8
9
10
# File 'lib/dradis/plugins/export/base.rb', line 8

def content_service
  @content_service
end

#loggerObject

Returns the value of attribute logger.



8
9
10
# File 'lib/dradis/plugins/export/base.rb', line 8

def logger
  @logger
end

#optionsObject

Returns the value of attribute options.



8
9
10
# File 'lib/dradis/plugins/export/base.rb', line 8

def options
  @options
end

#pluginObject

Returns the value of attribute plugin.



8
9
10
# File 'lib/dradis/plugins/export/base.rb', line 8

def plugin
  @plugin
end

#projectObject

Returns the value of attribute project.



8
9
10
# File 'lib/dradis/plugins/export/base.rb', line 8

def project
  @project
end

#scopeObject

Returns the value of attribute scope.



8
9
10
# File 'lib/dradis/plugins/export/base.rb', line 8

def scope
  @scope
end

Instance Method Details

#export(args = {}) ⇒ Object



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

def export(args={})
  raise "The export() method is not implemented in this plugin [#{self.class.name}]."
end

#post_initialize(args = {}) ⇒ Object

This method can be overwriten by plugins to do initialization tasks.



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

def post_initialize(args={})
end