Method: Thor::Group.get_options_from_invocations
- Defined in:
- lib/thor/group.rb
.get_options_from_invocations(group_options, base_options) ⇒ Object
Get invocations array and merge options from invocations. Those options are added to group_options hash. Options that already exists in base_options are not added twice.
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 |
# File 'lib/thor/group.rb', line 172 def (, ) #:nodoc: # rubocop:disable MethodLength invocations.each do |name, from_option| value = if from_option option = [name] option.type == :boolean ? name : option.default else name end next unless value klass, _ = prepare_for_invocation(name, value) next unless klass && klass.respond_to?(:class_options) value = value.to_s human_name = value.respond_to?(:classify) ? value.classify : value [human_name] ||= [] [human_name] += klass..values.select do |class_option| [class_option.name.to_sym].nil? && class_option.group.nil? && !.values.flatten.any? { |i| i.name == class_option.name } end yield klass if block_given? end end |