Skip to content

Commit

Permalink
ignoring -e
Browse files Browse the repository at this point in the history
  • Loading branch information
Nakilon committed Nov 22, 2021
1 parent a09276d commit 7397520
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 1 @@
/pkg
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 59,9 @@ constants_print.rb
lib/rasel.rb
...
```

You are supposed to pass this env var if you run the code via `-e`. Also note that in the next example we require the library we want to profiler before the profiler so we don't profile the initialization but only the invocation step:

```bash
$ LINEPROFILER=common.rb bundle exec ruby -r./common -rlineprofiler -e 'puts Common.my_method'
```
2 changes: 1 addition & 1 deletion lib/lineprofiler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 7,7 @@
end
END {
require "io/console"
[$0, *ENV["LINEPROFILER"]].each do |filename|
([$0, *ENV["LINEPROFILER"]] - %w{-e}).each do |filename|
puts filename
File.foreach(filename).with_index do |line, i|
v = profile.count do |bt|
Expand Down
2 changes: 1 addition & 1 deletion lineprofiler.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 1,6 @@
Gem::Specification.new do |spec|
spec.name = "lineprofiler"
spec.version = "0.0.0"
spec.version = "0.0.1"
spec.summary = "very simple Ruby line profiler"

spec.author = "Victor Maslov aka Nakilon"
Expand Down

0 comments on commit 7397520

Please sign in to comment.