Class: CssClassDuplicates::CLI
- Inherits:
-
Object
- Object
- CssClassDuplicates::CLI
- Defined in:
- lib/css_class_duplicates/cli.rb
Overview
The CLI is a class responsible of handling all the command line interface logic.
Constant Summary collapse
- STATUS_SUCCESS =
0
- STATUS_ERROR =
0
Instance Method Summary collapse
-
#initialize ⇒ CLI
constructor
A new instance of CLI.
- #run ⇒ Object
Constructor Details
#initialize ⇒ CLI
Returns a new instance of CLI.
9 10 11 |
# File 'lib/css_class_duplicates/cli.rb', line 9 def initialize @options = {} end |
Instance Method Details
#run ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/css_class_duplicates/cli.rb', line 13 def run entities = [] config = Config.new config.files.each do |file_name| entities.concat(config.parser.call(file_name)) end entities = config.merger.call(entities) entities = config.filter.call(entities) config.printer.call(entities) STATUS_SUCCESS rescue StandardError, SyntaxError, LoadError => e warn e. warn e.backtrace STATUS_ERROR end |