Class: Arachni::State::Plugins
Overview
Instance Attribute Summary collapse
- 
  
    
      #runtime  ⇒ Hash 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Runtime plugin data.
 
Class Method Summary collapse
Instance Method Summary collapse
- #[](plugin) ⇒ Object
 - #clear ⇒ Object
 - #delete(plugin) ⇒ Object
 - #dump(directory) ⇒ Object
 - #include?(plugin) ⇒ Bool
 - 
  
    
      #initialize  ⇒ Plugins 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of Plugins.
 - #statistics ⇒ Object
 - 
  
    
      #store(plugin, state)  ⇒ Object 
    
    
      (also: #[]=)
    
  
  
  
  
  
  
  
  
  
    
Registers plugin states.
 
Constructor Details
#initialize ⇒ Plugins
Returns a new instance of Plugins.
      19 20 21  | 
    
      # File 'lib/arachni/state/plugins.rb', line 19 def initialize @runtime = {} end  | 
  
Instance Attribute Details
#runtime ⇒ Hash (readonly)
Returns Runtime plugin data.
      17 18 19  | 
    
      # File 'lib/arachni/state/plugins.rb', line 17 def runtime @runtime end  | 
  
Class Method Details
.load(directory) ⇒ Object
      75 76 77 78 79 80 81 82 83 84 85 86  | 
    
      # File 'lib/arachni/state/plugins.rb', line 75 def self.load( directory ) plugins = new %w(runtime).each do |type| Dir["#{directory}/#{type}/*"].each do |plugin_directory| plugin = File.basename( plugin_directory ).to_sym plugins.send(type)[plugin] = Marshal.load( IO.binread( plugin_directory ) ) end end plugins end  | 
  
Instance Method Details
#[](plugin) ⇒ Object
      44 45 46  | 
    
      # File 'lib/arachni/state/plugins.rb', line 44 def []( plugin ) @runtime[plugin.to_sym] end  | 
  
#clear ⇒ Object
      88 89 90  | 
    
      # File 'lib/arachni/state/plugins.rb', line 88 def clear @runtime.clear end  | 
  
#delete(plugin) ⇒ Object
      52 53 54  | 
    
      # File 'lib/arachni/state/plugins.rb', line 52 def delete( plugin ) @runtime.delete( plugin.to_sym ) end  | 
  
#dump(directory) ⇒ Object
      64 65 66 67 68 69 70 71 72 73  | 
    
      # File 'lib/arachni/state/plugins.rb', line 64 def dump( directory ) %w(runtime).each do |type| send(type).each do |plugin, data| result_directory = "#{directory}/#{type}/" FileUtils.mkdir_p( result_directory ) IO.binwrite( "#{result_directory}/#{plugin}", Marshal.dump( data ) ) end end end  | 
  
#include?(plugin) ⇒ Bool
      60 61 62  | 
    
      # File 'lib/arachni/state/plugins.rb', line 60 def include?( plugin ) @runtime.include?( plugin.to_sym ) end  | 
  
#statistics ⇒ Object
      23 24 25 26 27  | 
    
      # File 'lib/arachni/state/plugins.rb', line 23 def statistics { names: @runtime.keys } end  | 
  
#store(plugin, state) ⇒ Object Also known as: []=
Registers plugin states.
      35 36 37  | 
    
      # File 'lib/arachni/state/plugins.rb', line 35 def store( plugin, state ) @runtime[plugin.to_sym] = state end  |