Class: CMSScanner::Controller::Base
- Inherits:
-
Object
- Object
- CMSScanner::Controller::Base
show all
- Includes:
- OptParseValidator
- Defined in:
- lib/cms_scanner/controller.rb
Overview
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.parsed_options=(options) ⇒ Object
Set the parsed options and initialize the browser with them
38
39
40
41
42
|
# File 'lib/cms_scanner/controller.rb', line 38
def self.parsed_options=(options)
@@parsed_options = options
NS::Browser.instance(options)
end
|
.reset ⇒ Object
Reset all the class attibutes Currently only used in specs
22
23
24
25
26
27
|
# File 'lib/cms_scanner/controller.rb', line 22
def self.reset
@@target = nil
@@parsed_options = nil
@@datastore = nil
@@formatter = nil
end
|
Instance Method Details
#==(other) ⇒ Object
16
17
18
|
# File 'lib/cms_scanner/controller.rb', line 16
def ==(other)
self.class == other.class
end
|
#after_scan ⇒ Object
14
|
# File 'lib/cms_scanner/controller.rb', line 14
def after_scan; end
|
#before_scan ⇒ Object
10
|
# File 'lib/cms_scanner/controller.rb', line 10
def before_scan; end
|
#cli_options ⇒ Array<OptParseValidator::OptBase>
8
|
# File 'lib/cms_scanner/controller.rb', line 8
def cli_options; end
|
#datastore ⇒ Hash
50
51
52
|
# File 'lib/cms_scanner/controller.rb', line 50
def datastore
@@datastore ||= {}
end
|
55
56
57
|
# File 'lib/cms_scanner/controller.rb', line 55
def formatter
@@formatter ||= NS::Formatter.load(parsed_options[:format], datastore[:views])
end
|
#output(tpl, vars = {}) ⇒ Void
62
63
64
|
# File 'lib/cms_scanner/controller.rb', line 62
def output(tpl, vars = {})
formatter.output(*tpl_params(tpl, vars))
end
|
#parsed_options ⇒ Hash
45
46
47
|
# File 'lib/cms_scanner/controller.rb', line 45
def parsed_options
@@parsed_options ||= {}
end
|
#render(tpl, vars = {}) ⇒ String
69
70
71
|
# File 'lib/cms_scanner/controller.rb', line 69
def render(tpl, vars = {})
formatter.render(*tpl_params(tpl, vars))
end
|
#run ⇒ Object
12
|
# File 'lib/cms_scanner/controller.rb', line 12
def run; end
|
30
31
32
|
# File 'lib/cms_scanner/controller.rb', line 30
def target
@@target ||= NS::Target.new(parsed_options[:url], parsed_options)
end
|
#tmp_directory ⇒ String
79
80
81
|
# File 'lib/cms_scanner/controller.rb', line 79
def tmp_directory
File.join('/tmp', NS.app_name)
end
|
#user_interaction? ⇒ Boolean
74
75
76
|
# File 'lib/cms_scanner/controller.rb', line 74
def user_interaction?
formatter.user_interaction? && !parsed_options[:output]
end
|