{"id":21429978,"url":"https://github.com/mblumtritt/im-lost","last_synced_at":"2025-04-06T11:35:58.586Z","repository":{"id":239435251,"uuid":"799518415","full_name":"mblumtritt/im-lost","owner":"mblumtritt","description":"Your debugging helper.","archived":false,"fork":false,"pushed_at":"2025-01-30T23:14:05.000Z","size":36,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-15T03:17:56.267Z","etag":null,"topics":["debug","debugging-tools","ruby","ruby-gem","trace"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mblumtritt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-12T11:49:42.000Z","updated_at":"2025-01-30T23:13:09.000Z","dependencies_parsed_at":"2024-05-12T13:30:55.004Z","dependency_job_id":"04164b91-db14-4012-8f90-a1ed4a90c361","html_url":"https://github.com/mblumtritt/im-lost","commit_stats":null,"previous_names":["mblumtritt/im-lost"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mblumtritt%2Fim-lost","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mblumtritt%2Fim-lost/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mblumtritt%2Fim-lost/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mblumtritt%2Fim-lost/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mblumtritt","download_url":"https://codeload.github.com/mblumtritt/im-lost/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247478233,"owners_count":20945262,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["debug","debugging-tools","ruby","ruby-gem","trace"],"created_at":"2024-11-22T22:19:58.925Z","updated_at":"2025-04-06T11:35:58.563Z","avatar_url":"https://github.com/mblumtritt.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ImLost ![version](https://img.shields.io/gem/v/im-lost?label=)\n\nIf 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!\n\nImLost 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!\n\n- Gem: [rubygems.org](https://rubygems.org/gems/im-lost)\n- Source: [github.com](https://github.com/mblumtritt/im-lost)\n- Help: [rubydoc.info](https://rubydoc.info/gems/im-lost/ImLost)\n\n## Description\n\nIf you like to understand method call details you get a call trace with `ImLost.trace`:\n\n```ruby\nFile.open('test.txt', 'w') do |file|\n  ImLost.trace(file) do\n    file \u003c\u003c 'hello '\n    file.puts(:world!)\n  end\nend\n\n# output will look like\n#  \u003e IO#\u003c\u003c(?)\n#    /examples/test.rb:1\n#  \u003e IO#write(*)\n#    /examples/test.rb:1\n#  \u003e IO#puts(*)\n#    /examples/test.rb:2\n#  \u003e IO#write(*)\n#    /examples/test.rb:2\n```\n\nWhen you need to know if exceptions are raised and handled you can use `ImLost.trace_exceptions`:\n\n```ruby\nImLost.trace_exceptions do\n  File.write('/', 'test')\nrescue SystemCallError\n  raise('something went wrong!')\nend\n\n# output will look like\n#  x Errno::EEXIST: File exists @ rb_sysopen - /\n#    /examples/test.rb:2\n#  ! Errno::EEXIST: File exists @ rb_sysopen - /\n#    /examples/test.rb:3\n#  x RuntimeError: something went wrong!\n#    /examples/test.rb:4\n```\n\nWhen you like to know if a code point is reached, `ImLost.here` will help:\n\n```ruby\nImLost.here\n```\n\nIf you like to know the instance variables values of an object, use\n`ImLost.vars`:\n\n```ruby\nImLost.vars(self)\n```\n\nOr you can print the current local variables:\n\n```ruby\nImLost.vars(binding)\n```\n\nSee the [online help](https://rubydoc.info/gems/im-lost/ImLost) for more!\n\n## Example\n\n```ruby\nrequire 'im-lost'\n\nrequire_relative '../lib/im-lost'\n\nclass Foo\n  def self.create(value:) = new(value)\n\n  attr_reader :value\n\n  def initialize(value)\n    @value = value\n  end\n\n  def foo(arg, *args, key: nil, **kw_args, \u0026block)\n    @value = \"#{arg}-#{key}-[#{args.join(',')}]-#{kw_args.inspect}-#{bar}\"\n    block ? block.call(@value) : @value\n  end\n\n  def bar = :bar\nend\n\nImLost.trace(Foo)\n\nmy_foo = Foo.create(value: :foo!)\nImLost.trace(my_foo)\n\nmy_foo.foo(1, key: :none)\nImLost.vars(my_foo)\n\nmy_foo.foo(2, :a, :b, :c, key: :some, name: :value)\nImLost.vars(my_foo)\n\nmy_foo.foo(3) { puts _1 }\nImLost.vars(my_foo)\n\n# output will look like\n#   \u003e Foo.create(:foo!)\n#     /examples/foo.rb:24\n#   \u003e Foo.new(*)\n#     /examples/foo.rb:6\n#   \u003c Foo.new(*)\n#     /examples/foo.rb:6\n#     = #\u003cFoo:0x00000001006448c0 @value=:foo!\u003e\n#   \u003c Foo.create(:foo!)\n#     /examples/foo.rb:24\n#     = #\u003cFoo:0x00000001006448c0 @value=:foo!\u003e\n#   \u003e Foo#foo(1, *[], :none, **{}, \u0026nil)\n#     /examples/foo.rb:27\n#   \u003e Foo#bar()\n#     /examples/foo.rb:15\n#   \u003c Foo#bar()\n#     /examples/foo.rb:15\n#     = :bar\n#   \u003c Foo#foo(1, *[], :none, **{}, \u0026nil)\n#     /examples/foo.rb:27\n#     = \"1-none-[]-{}-bar\"\n#   * /examples/foo.rb:28\n#     \u003e instance variables\n#       @value: \"1-none-[]-{}-bar\"\n#   \u003e Foo#foo(2, *[:a, :b, :c], :some, **{:name=\u003e:value}, \u0026nil)\n#     /examples/foo.rb:30\n#   \u003e Foo#bar()\n#     /examples/foo.rb:15\n#   \u003c Foo#bar()\n#     /examples/foo.rb:15\n#     = :bar\n#   \u003c Foo#foo(2, *[:a, :b, :c], :some, **{:name=\u003e:value}, \u0026nil)\n#     /examples/foo.rb:30\n#     = \"2-some-[a,b,c]-{:name=\u003e:value}-bar\"\n#   * /examples/foo.rb:31\n#     \u003e instance variables\n#       @value: \"2-some-[a,b,c]-{:name=\u003e:value}-bar\"\n#   \u003e Foo#foo(3, *[], nil, **{}, \u0026#\u003cProc:0x0000000100641d28 /examples/foo.rb:33\u003e)\n#     /examples/foo.rb:33\n#   \u003e Foo#bar()\n#     /examples/foo.rb:15\n#   \u003c Foo#bar()\n#     /examples/foo.rb:15\n#     = :bar\n#   3--[]-{}-bar\n#   \u003c Foo#foo(3, *[], nil, **{}, \u0026#\u003cProc:0x0000000100641d28 /examples/foo.rb:33\u003e)\n#     /examples/foo.rb:33\n#     = nil\n#   * /examples/foo.rb:34\n#     \u003e instance variables\n#       @value: \"3--[]-{}-bar\"\n```\n\nSee [examples dir](./examples) for more…\n\n## Installation\n\nYou can install the gem in your system with\n\n```shell\ngem install im-lost\n```\n\nor you can use [Bundler](http://gembundler.com/) to add ImLost to your own project:\n\n```shell\nbundle add im-lost\n```\n\nAfter that you only need one line of code to have everything together\n\n```ruby\nrequire 'im-lost'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmblumtritt%2Fim-lost","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmblumtritt%2Fim-lost","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmblumtritt%2Fim-lost/lists"}