Class: Arachni::UI::Web::Addons::Base
- Defined in:
- lib/arachni/ui/web/addon_manager.rb
Overview
Base class for all add-ons.
Instance Method Summary collapse
- #adelete(path, &block) ⇒ Object
- #aget(path, &block) ⇒ Object
- #apost(path, &block) ⇒ Object
- #aput(path, &block) ⇒ Object
- #delete(path, &block) ⇒ Object
- #get(path, &block) ⇒ Object
-
#initialize(settings, route) ⇒ Base
constructor
A new instance of Base.
- #path_addon ⇒ Object
- #path_root ⇒ Object
- #path_views ⇒ Object
- #post(path, &block) ⇒ Object
- #put(path, &block) ⇒ Object
- #run ⇒ Object
- #settings ⇒ Object
-
#title ⇒ String
This optional method allows you to specify the title which will be used for the menu (in case you want it to be dynamic).
Constructor Details
#initialize(settings, route) ⇒ Base
Returns a new instance of Base.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/arachni/ui/web/addon_manager.rb', line 34 def initialize( settings, route ) @settings = settings @route = '/addons/' + route @settings.helpers do def present( tpl, args ) views = current_addon.path_views trv = ( '../' * views.split( '/' ).size ) + views + tpl.to_s erb_args = [] erb_args << { :layout => true } erb_args << { :tpl => trv.to_sym, :addon => addons.by_name( current_addon_name ), :tpl_args => args } erb :addon, *erb_args end def async_present( *args ) body present( *args ) end def partial( tpl, args ) views = current_addon.path_views trv = ( '../' * views.split( '/' ).size ) + views + tpl.to_s erb_args = [] erb_args << { :layout => false } erb_args << args erb trv.to_sym, *erb_args end def current_addon_name env['PATH_INFO'].scan( /\/addons\/(.*?)\// ).flatten[0] end def current_addon addons.running[current_addon_name] end end end |
Instance Method Details
#adelete(path, &block) ⇒ Object
144 145 146 |
# File 'lib/arachni/ui/web/addon_manager.rb', line 144 def adelete( path, &block ) settings.adelete( @route + path, &block ) end |
#aget(path, &block) ⇒ Object
120 121 122 |
# File 'lib/arachni/ui/web/addon_manager.rb', line 120 def aget( path, &block ) settings.aget( @route + path, &block ) end |
#apost(path, &block) ⇒ Object
128 129 130 |
# File 'lib/arachni/ui/web/addon_manager.rb', line 128 def apost( path, &block ) settings.apost( @route + path, &block ) end |
#aput(path, &block) ⇒ Object
136 137 138 |
# File 'lib/arachni/ui/web/addon_manager.rb', line 136 def aput( path, &block ) settings.aput( @route + path, &block ) end |
#delete(path, &block) ⇒ Object
140 141 142 |
# File 'lib/arachni/ui/web/addon_manager.rb', line 140 def delete( path, &block ) settings.delete( @route + path, &block ) end |
#get(path, &block) ⇒ Object
116 117 118 |
# File 'lib/arachni/ui/web/addon_manager.rb', line 116 def get( path, &block ) settings.get( @route + path, &block ) end |
#path_addon ⇒ Object
86 87 88 |
# File 'lib/arachni/ui/web/addon_manager.rb', line 86 def path_addon Options.instance.dir['lib'] + 'ui/web' + path_root end |
#path_root ⇒ Object
78 79 80 |
# File 'lib/arachni/ui/web/addon_manager.rb', line 78 def path_root @route end |
#path_views ⇒ Object
82 83 84 |
# File 'lib/arachni/ui/web/addon_manager.rb', line 82 def path_views path_addon + '/views/' end |
#post(path, &block) ⇒ Object
124 125 126 |
# File 'lib/arachni/ui/web/addon_manager.rb', line 124 def post( path, &block ) settings.post( @route + path, &block ) end |
#put(path, &block) ⇒ Object
132 133 134 |
# File 'lib/arachni/ui/web/addon_manager.rb', line 132 def put( path, &block ) settings.put( @route + path, &block ) end |
#run ⇒ Object
90 91 92 |
# File 'lib/arachni/ui/web/addon_manager.rb', line 90 def run end |
#settings ⇒ Object
112 113 114 |
# File 'lib/arachni/ui/web/addon_manager.rb', line 112 def settings @settings end |
#title ⇒ String
This optional method allows you to specify the title which will be used for the menu (in case you want it to be dynamic).
100 101 102 |
# File 'lib/arachni/ui/web/addon_manager.rb', line 100 def title '' end |