Class: Dradis::Plugins::Nipper::FieldProcessor

Inherits:
Upload::FieldProcessor
  • Object
show all
Defined in:
lib/dradis/plugins/nipper/field_processor.rb

Constant Summary collapse

ALLOWED_DATA_NAMES =
%w{devices section}

Instance Method Summary collapse

Instance Method Details

#post_initialize(args = {}) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/dradis/plugins/nipper/field_processor.rb', line 7

def post_initialize(args = {})
  raise 'Unhandled data name!' unless ALLOWED_DATA_NAMES.include?(data.name)

  @nipper_object =
    if data.name == 'section'
      ::Nipper::Issue.new(data)
    elsif data.name == 'devices'
      ::Nipper::Evidence.new(data)
    end
end

#value(args = {}) ⇒ Object



18
19
20
21
22
23
# File 'lib/dradis/plugins/nipper/field_processor.rb', line 18

def value(args = {})
  field = args[:field]
  _, name = field.split('.')

  @nipper_object.try(name) || 'n/a'
end