
Security News
CISA’s 2025 SBOM Guidance Adds Hashes, Licenses, Tool Metadata, and Context
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
If you have overlooked something again and don't really understand what your code is doing. If you have to maintain this application but can't really find your way around and certainly can't track down that stupid error. If you feel lost in all that code, here's the gem to help you out!
ImLost helps you by analyzing function calls of objects, informing you about exceptions and logging your way through your code. In short, ImLost is your debugging helper!
If you like to understand method call details you get a call trace with ImLost.trace
:
File.open('test.txt', 'w') do |file|
ImLost.trace(file) do
file << 'hello '
file.puts(:world!)
end
end
# output will look like
# > IO#<<(?)
# /examples/test.rb:1
# > IO#write(*)
# /examples/test.rb:1
# > IO#puts(*)
# /examples/test.rb:2
# > IO#write(*)
# /examples/test.rb:2
When you need to know if exceptions are raised and handled you can use ImLost.trace_exceptions
:
ImLost.trace_exceptions do
File.write('/', 'test')
rescue SystemCallError
raise('something went wrong!')
end
# output will look like
# x Errno::EEXIST: File exists @ rb_sysopen - /
# /examples/test.rb:2
# ! Errno::EEXIST: File exists @ rb_sysopen - /
# /examples/test.rb:3
# x RuntimeError: something went wrong!
# /examples/test.rb:4
When you like to know if a code point is reached, ImLost.here
will help:
ImLost.here
If you like to know the instance variables values of an object, use
ImLost.vars
:
ImLost.vars(self)
Or you can print the current local variables:
ImLost.vars(binding)
See the online help for more!
require 'im-lost'
class Foo
def self.create(value:) = new(value)
attr_reader :value
def initialize(value)
@value = value
end
def foo(arg, *args, key: nil, **kw_args, &block)
@value = "#{arg}-#{key}-[#{args.join(',')}]-#{kw_args.inspect}-#{bar}"
block ? block.call(@value) : @value
end
def bar = :bar
end
ImLost.trace(Foo)
my_foo = Foo.create(value: :foo!)
ImLost.trace(my_foo)
my_foo.foo(1, key: :none)
ImLost.vars(my_foo)
my_foo.foo(2, :a, :b, :c, key: :some, name: :value)
ImLost.vars(my_foo)
my_foo.foo(3) { puts _1 }
ImLost.vars(my_foo)
# output will look like
# > Foo.create(:foo!)
# ./examples/foo.rb:24
# > Foo.new(*args)
# ./examples/foo.rb:6
# < Foo.new(*args)
# ./examples/foo.rb:6
# = #<Foo:0x0000000104c24b88 @value=:foo!>
# < Foo.create(:foo!)
# ./examples/foo.rb:24
# = #<Foo:0x0000000104c24b88 @value=:foo!>
# > Foo#foo(1, *[], :none, **{}, &nil)
# ./examples/foo.rb:27
# > Foo#bar()
# ./examples/foo.rb:15
# < Foo#bar()
# ./examples/foo.rb:15
# = :bar
# < Foo#foo(1, *[], :none, **{}, &nil)
# ./examples/foo.rb:27
# = "1-none-[]-{}-bar"
# * ./examples/foo.rb:28
# > instance variables
# @value: "1-none-[]-{}-bar"
# > Foo#foo(2, *[:a, :b, :c], :some, **{name: :value}, &nil)
# ./examples/foo.rb:30
# > Foo#bar()
# ./examples/foo.rb:15
# < Foo#bar()
# ./examples/foo.rb:15
# = :bar
# < Foo#foo(2, *[:a, :b, :c], :some, **{name: :value}, &nil)
# ./examples/foo.rb:30
# = "2-some-[a,b,c]-{name: :value}-bar"
# * ./examples/foo.rb:31
# > instance variables
# @value: "2-some-[a,b,c]-{name: :value}-bar"
# > Foo#foo(3, *[], nil, **{}, &#<Proc:0x0000000104c22180 ./examples/foo.rb:33>)
# ./examples/foo.rb:33
# > Foo#bar()
# ./examples/foo.rb:15
# < Foo#bar()
# ./examples/foo.rb:15
# = :bar
# 3--[]-{}-bar
# < Foo#foo(3, *[], nil, **{}, &#<Proc:0x0000000104c22180 ./examples/foo.rb:33>)
# ./examples/foo.rb:33
# = nil
# * ./examples/foo.rb:34
# > instance variables
# @value: "3--[]-{}-bar"
See examples dir for more…
You can install the gem in your system with
gem install im-lost
or you can use Bundler to add ImLost to your own project:
bundle add im-lost
After that you only need one line of code to have everything together
require 'im-lost'
FAQs
Unknown package
We found that im-lost demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.