Class: Memorandom::PluginTemplate

Inherits:
Object
  • Object
show all
Defined in:
lib/memorandom/plugins/template.rb

Constant Summary collapse

@@description =
"This is an unconfigured plugin using the base template"
@@confidence =
0.80

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scanner) ⇒ PluginTemplate

Returns a new instance of PluginTemplate.



9
10
11
12
# File 'lib/memorandom/plugins/template.rb', line 9

def initialize(scanner)
  self.scanner = scanner
  self.hits = {}
end

Instance Attribute Details

#hitsObject

Returns the value of attribute hits.



7
8
9
# File 'lib/memorandom/plugins/template.rb', line 7

def hits
  @hits
end

#scannerObject

Returns the value of attribute scanner.



7
8
9
# File 'lib/memorandom/plugins/template.rb', line 7

def scanner
  @scanner
end

Class Method Details

.confidenceObject



33
34
35
# File 'lib/memorandom/plugins/template.rb', line 33

def self.confidence
  @@confidence
end

.descriptionObject



29
30
31
# File 'lib/memorandom/plugins/template.rb', line 29

def self.description
  @@description
end

Instance Method Details

#confidenceObject



41
42
43
# File 'lib/memorandom/plugins/template.rb', line 41

def confidence
  self.class.confidence
end

#descriptionObject



37
38
39
# File 'lib/memorandom/plugins/template.rb', line 37

def description
  self.class.description
end

#report_hit(info = {}) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/memorandom/plugins/template.rb', line 14

def report_hit(info = {})
  unless info[:offset] and info[:type]
    raise RuntimeError, "No offset or type supplied in the hit: #{info.inspect}"
  end

  scanner.report_hit(info.merge({:plugin => self }))

  offset = info.delete(:offset)
  self.hits[offset] = info
end

#resetObject



25
26
27
# File 'lib/memorandom/plugins/template.rb', line 25

def reset
  self.hits = {}
end