Skip to content

Commit

Permalink
Kernel refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
AndyObtiva committed Oct 2, 2020
1 parent 979f670 commit 59ae60b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/puts_debuggerer/core_ext/kernel.rb
Expand Up @@ -43,7 +43,7 @@ def pd(*objects)
if PutsDebuggerer::RunDeterminer.run_pd?(object, run_at)
__with_pd_options__(options) do |print_engine_options|
run_number = PutsDebuggerer::RunDeterminer.run_number(object, run_at)
formatter_pd_data = __build_pd_data__(object, print_engine_options, PutsDebuggerer.source_line_count, run_number, pd_inspect, logger_formatter_decorated, logging_layouts_decorated) #depth adds build method
formatter_pd_data = __build_pd_data__(object, print_engine_options: print_engine_options, source_line_count: PutsDebuggerer.source_line_count, run_number: run_number, pd_inspect: pd_inspect, logger_formatter_decorated: logger_formatter_decorated, logging_layouts_decorated: logging_layouts_decorated)
stdout = $stdout
$stdout = sio = StringIO.new
PutsDebuggerer.formatter.call(formatter_pd_data)
Expand Down Expand Up @@ -159,11 +159,13 @@ def __with_pd_options__(options=nil)
PutsDebuggerer.options = permanent_options
end

def __build_pd_data__(object, print_engine_options=nil, source_line_count=nil, run_number=nil, pd_inspect=false, logger_formatter_decorated=false, logging_layouts_decorated=false)
def __build_pd_data__(object, print_engine_options:nil, source_line_count:nil, run_number:nil, pd_inspect:false, logger_formatter_decorated:false, logging_layouts_decorated:false)
depth = RUBY_PLATFORM == 'opal' ? PutsDebuggerer::CALLER_DEPTH_ZERO_OPAL : PutsDebuggerer::CALLER_DEPTH_ZERO
depth += 1 if pd_inspect
depth += 4 if pd_inspect && logger_formatter_decorated
depth += 8 if pd_inspect && logging_layouts_decorated
if pd_inspect
depth += 1
depth += 4 if logger_formatter_decorated
depth += 8 if logging_layouts_decorated
end

pd_data = {
announcer: PutsDebuggerer.announcer,
Expand Down

0 comments on commit 59ae60b

Please sign in to comment.