class Dradis::Plugins::Saint::FieldProcessor

Constants

ALLOWED_DATA_NAMES

Public Instance Methods

post_initialize(args={}) click to toggle source
# File lib/dradis/plugins/saint/field_processor.rb, line 8
def post_initialize(args={})
  raise 'Unhandled data name!' unless ALLOWED_DATA_NAMES.include?(data.name)
  @saint_object =
    "::Saint::#{data.name.capitalize}".constantize.new(data)
end
value(args={}) click to toggle source
# File lib/dradis/plugins/saint/field_processor.rb, line 14
def value(args={})
  field = args[:field]
  _, name = field.split('.')

  # We cannot send the message 'class' to the saint_object because it
  # evaluates to the object's Ruby class. We temporarily rename the
  # field to 'vuln_class' and switch it back later when needed.
  if name == 'class'
    name = 'vuln_class'
  end

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