What object-oriented programming advice is this code violating?
def check_for_overheating(system_monitor)
if system_monitor.temperature > 100
system_monitor.sound_alarms
end
end
require 'stringio' | |
require 'timeout' | |
class Object | |
def methods_returning(expected, *args, &blk) | |
old_stdout = $> | |
$> = StringIO.new | |
methods.select do |meth| | |
Timeout::timeout(1) { dup.public_send(meth, *args, &blk) == expected rescue false } rescue false |
#in application.rb | |
module YourApp | |
class Application < Rails::Application | |
config.middleware.insert_before ActionDispatch::ParamsParser, "ParsingFailureToJSON" | |
... | |
end | |
end | |
#The Parsing failure middleware | |
class ParsingFailureToJSON |