Class: CliOptions
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- CliOptions
- Defined in:
- lib/hiptest-publisher/options_parser.rb
Instance Method Summary collapse
- #actionwords_diff? ⇒ Boolean
- #groups_to_keep ⇒ Object
-
#initialize(hash = nil) ⇒ CliOptions
constructor
A new instance of CliOptions.
- #language_framework ⇒ Object
- #normalize!(reporter = nil) ⇒ Object
Constructor Details
#initialize(hash = nil) ⇒ CliOptions
Returns a new instance of CliOptions.
58 59 60 61 62 63 |
# File 'lib/hiptest-publisher/options_parser.rb', line 58 def initialize(hash=nil) hash ||= {} hash[:language] ||= "" hash[:framework] ||= "" super(__cli_args: Set.new, __config_args: Set.new, **hash) end |
Instance Method Details
#actionwords_diff? ⇒ Boolean
65 66 67 |
# File 'lib/hiptest-publisher/options_parser.rb', line 65 def actionwords_diff? actionwords_diff || aw_deleted || aw_created || aw_renamed || aw_signature_changed end |
#groups_to_keep ⇒ Object
77 78 79 |
# File 'lib/hiptest-publisher/options_parser.rb', line 77 def groups_to_keep only.split(",") if only end |
#language_framework ⇒ Object
69 70 71 72 73 74 75 |
# File 'lib/hiptest-publisher/options_parser.rb', line 69 def language_framework if framework.empty? language else "#{language}-#{framework}" end end |
#normalize!(reporter = nil) ⇒ Object
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/hiptest-publisher/options_parser.rb', line 81 def normalize!(reporter = nil) = self.clone if actionwords_only .only = 'actionwords' elsif tests_only .only = 'tests' end if language.include?('-') .language, .framework = language.split("-", 2) elsif framework.empty? # pick first framework for the language _, frameworks = OptionsParser.languages.find do |language, frameworks| language.downcase.gsub(' ', '') == self.language.downcase.gsub(' ', '') end if frameworks .framework = frameworks.first.downcase end end if self != delta = .table.select do |key, value| [key] != self[key] end marshal_load(.marshal_dump) if reporter reporter.(delta, 'Options have been normalized. Values updated:') end return delta end end |