Class: ESM::Command::Development::Eval

Inherits:
ApplicationCommand show all
Defined in:
lib/esm/command/development/eval.rb

Instance Method Summary collapse

Instance Method Details

#on_executeObject

lmao, the amount of rubocop disables in this one method



35
36
37
38
39
40
41
42
43
# File 'lib/esm/command/development/eval.rb', line 35

def on_execute
  code = arguments.code
  return binding.pry if code == "bd" && ESM.env.development? # rubocop:disable Lint/Debugger

  response = eval arguments.code # rubocop:disable Security/Eval
  reply("Input:\n```ruby\n#{arguments.code}\n```\nOutput:\n```ruby\n#{response.ai(plain: true, index: false)}\n```") # rubocop:disable Rails/Output
rescue => e
  reply("An error occurred: ```#{e.message}```Backtrace: ```#{e.backtrace[0..2].join("\n")}```")
end