module Commander::UI::AskForClass
Implements ask_for_CLASS methods.
Constants
- DEPRECATED_CONSTANTS
Public Instance Methods
method_missing(method_name, *arguments, &block)
click to toggle source
Calls superclass method
# File lib/murano-cli-commander/user_interaction.rb, line 336 def method_missing(method_name, *arguments, &block) if method_name.to_s =~ /^ask_for_(.*)/ if arguments.count != 1 fail ArgumentError, "wrong number of arguments (given #{arguments.count}, expected 1)" end prompt = arguments.first requested_class = Regexp.last_match[1] # All Classes that respond to #parse # Ignore constants that trigger deprecation warnings available_classes = (Object.constants - DEPRECATED_CONSTANTS).map do |const| Object.const_get(const) end.select do |const| const.class == Class && const.respond_to?(:parse) end klass = available_classes.find { |k| k.to_s.downcase == requested_class } if klass $terminal.ask(prompt, klass) else super end else super end end
respond_to_missing?(method_name, include_private = false)
click to toggle source
Calls superclass method
# File lib/murano-cli-commander/user_interaction.rb, line 363 def respond_to_missing?(method_name, include_private = false) method_name.to_s.start_with?('ask_for_') || super end