Skip to content

Instantly share code, notes, and snippets.

@exterm
Created February 20, 2024 22:22
Show Gist options
  • Select an option

  • Save exterm/a915f6cd51f4a9a8d6c9f893965436fc to your computer and use it in GitHub Desktop.

Select an option

Save exterm/a915f6cd51f4a9a8d6c9f893965436fc to your computer and use it in GitHub Desktop.

Revisions

  1. exterm created this gist Feb 20, 2024.
    29 changes: 29 additions & 0 deletions config_boot.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    # add to config/boot.rb

    require "benchmark"

    $require_nesting = -1

    def require(file_name)
    result = nil

    $require_nesting += 1

    time = Benchmark.realtime do
    result = super
    end

    if result
    if time > 0.2
    indentation = "=" * $require_nesting
    puts indentation + "> #{time} #{file_name}"
    # else
    # indentation = "-" * $require_nesting
    # puts indentation + "> #{time} #{file_name}"
    end
    end

    $require_nesting -= 1

    result
    end