Class: BetterCap::Spoofers::Base
- Inherits:
-
Object
- Object
- BetterCap::Spoofers::Base
- Defined in:
- lib/bettercap/spoofers/base.rb
Overview
Base class for BetterCap::Spoofers modules.
Constant Summary collapse
- @@loaded =
Hash of available spoofers ( spoofer name -> class name )
{}
Class Method Summary collapse
-
.available ⇒ Object
Return a list of available spoofers names.
-
.get_by_name(name) ⇒ Object
Create an instance of a BetterCap::Spoofers object given its
name
. -
.inherited(subclass) ⇒ Object
Called when this base class is inherited from one of the spoofers.
Instance Method Summary collapse
-
#initialize ⇒ Base
constructor
Will raise NotImplementedError .
-
#start ⇒ Object
Will raise NotImplementedError .
-
#stop ⇒ Object
Will raise NotImplementedError .
Constructor Details
#initialize ⇒ Base
Will raise NotImplementedError .
41 42 43 |
# File 'lib/bettercap/spoofers/base.rb', line 41 def initialize not_implemented_method! end |
Class Method Details
.available ⇒ Object
Return a list of available spoofers names.
28 29 30 |
# File 'lib/bettercap/spoofers/base.rb', line 28 def available @@loaded.keys end |
.get_by_name(name) ⇒ Object
Create an instance of a BetterCap::Spoofers object given its name
. Will raise a BetterCap::Error if name
is not valid.
34 35 36 37 |
# File 'lib/bettercap/spoofers/base.rb', line 34 def get_by_name(name) raise BetterCap::Error, "Invalid spoofer name '#{name}'!" unless available.include? name BetterCap::Loader.load(@@loaded[name]).new end |
.inherited(subclass) ⇒ Object
Called when this base class is inherited from one of the spoofers.
22 23 24 25 |
# File 'lib/bettercap/spoofers/base.rb', line 22 def inherited(subclass) name = subclass.name.split('::')[2].upcase @@loaded[name] = subclass.name end |
Instance Method Details
#start ⇒ Object
Will raise NotImplementedError .
45 46 47 |
# File 'lib/bettercap/spoofers/base.rb', line 45 def start not_implemented_method! end |
#stop ⇒ Object
Will raise NotImplementedError .
49 50 51 |
# File 'lib/bettercap/spoofers/base.rb', line 49 def stop not_implemented_method! end |