Class: CMSScanner::Controllers
- Inherits:
-
Array
- Object
- Array
- CMSScanner::Controllers
- Defined in:
- lib/cms_scanner/controllers.rb
Overview
Controllers Container
Instance Attribute Summary collapse
-
#option_parser ⇒ Object
readonly
Returns the value of attribute option_parser.
Instance Method Summary collapse
- #<<(controller) ⇒ Object
-
#initialize(option_parser = OptParseValidator::OptParser.new(nil, 40)) ⇒ Controllers
constructor
A new instance of Controllers.
-
#register_options_files ⇒ Object
Adds the potential option file paths to the option_parser.
- #run ⇒ Object
Constructor Details
#initialize(option_parser = OptParseValidator::OptParser.new(nil, 40)) ⇒ Controllers
Returns a new instance of Controllers.
7 8 9 10 11 |
# File 'lib/cms_scanner/controllers.rb', line 7 def initialize(option_parser = OptParseValidator::OptParser.new(nil, 40)) @option_parser = option_parser end |
Instance Attribute Details
#option_parser ⇒ Object (readonly)
Returns the value of attribute option_parser.
4 5 6 |
# File 'lib/cms_scanner/controllers.rb', line 4 def option_parser @option_parser end |
Instance Method Details
#<<(controller) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/cms_scanner/controllers.rb', line 25 def <<(controller) = controller. unless include?(controller) option_parser.add(*) if super(controller) end self end |
#register_options_files ⇒ Object
Adds the potential option file paths to the option_parser
14 15 16 17 18 19 20 |
# File 'lib/cms_scanner/controllers.rb', line 14 def [Dir.home, Dir.pwd].each do |dir| option_parser..supported_extensions.each do |ext| @option_parser. << Pathname.new(dir).join(".#{NS.app_name}", "cli_options.#{ext}").to_s end end end |
#run ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/cms_scanner/controllers.rb', line 35 def run = option_parser.results first.class. = redirect_output_to_file([:output]) if [:output] each(&:before_scan) each(&:run) reverse_each(&:after_scan) end |