Class: Railjet::Console::RailjetHelpers::RailjetContextHelper
- Inherits:
-
Object
- Object
- Railjet::Console::RailjetHelpers::RailjetContextHelper
- Defined in:
- lib/railjet/console/debug_helpers.rb
Class Method Summary collapse
Class Method Details
.determine_context_class ⇒ Object
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/railjet/console/debug_helpers.rb', line 103 def self.determine_context_class contexts_classes = Railjet::Context.descendants contexts_classes.each_with_index do |context_class, index| puts "(#{index + 1}) #{context_class}" end puts "\nPlease enter the number of needed railjet context" puts "(default: #{contexts_classes.first})" puts '-' * 61 begin input = $stdin.gets.strip if input.present? chosen_index = Float(input) contexts_classes.fetch(chosen_index - 1) else contexts_classes[0] end rescue StandardError puts 'Invalid choice. Please try again.' retry end end |
.print_context_param_errors(missing_methods) ⇒ Object
127 128 129 130 131 132 133 134 135 136 137 138 |
# File 'lib/railjet/console/debug_helpers.rb', line 127 def self.print_context_param_errors(missing_methods) return if missing_methods.empty? puts '!' * 61 puts "\nError raised while finding context value(s) for methods below using `nil` instead" puts "To assign value simply define function(s) in console and it will be used the next time\n\n" missing_methods.each do |error| puts "\t- Method `#{error.keys.first}` => error: `#{error.values.first}`" end puts "\n" puts '!' * 61 end |