Project

wut

0.0
The project is in a healthy, maintained state
wut is a small library that adds simple, print debugging commands. It makes it easy to inspect and output current variable values without cluttering your code, acting as an upgrade for puts-based debugging. It uses only Ruby’s built-in features (no extra dependencies).
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 3.0
~> 0.9
 Project Readme

Wut

Wut is a faster, lazier, way to do puts debugging. With 3 characters, you can get a printout of your variable values. Great for debugging, or feeding into an LLM.

w.tf

Features

  • Dynamic Variable Inspection: View locals, instance variables, globals, class variables, and let variables with simple commands.
  • Customizable Output: Automatically excludes ignored variables defined in an ignore list.
  • Colorized Output: Enhanced readability with color-coded debug information.

Installation

Add Wut to your Gemfile:

bundle add wut

Or install it manually:

gem install wut

Usage

Commands

Wut enhances the binding object, allowing you to inspect variables with concise syntax: It also gives you a short alias--w for quick debugging.

  • w.l - Print local variables.
  • w.i - Print instance variables.
  • w.c - Print class variables.
  • w.g - Print global variables.
  • w.tf - Print the full set of variables--locals, instance, class and lets.
  • w.tf? - Print the full set of variables, plus globals too.

If you opt not to create the alias for binding, you can get the same methods from binding.

require 'wut'

class Example
  @@class_var = "class variable"

  def initialize
    @instance_var = "instance variable"
  end

  def debug_example
    local_var = "local variable"
    w.tf?  # Print all variables
    w.l  # Print only locals
  end
end

Example.new.debug_example

Output:

From: example.rb:13

Locals:
  local_var: "local variable"

Instances:
  @instance_var: "instance variable"

Class Vars:
  @@class_var: "class variable"

Globals:

Ignore List

Customize the variables excluded from output by adding them to the ignore list:

Wut.ignore_list << :@ignored_var

Integration

Automatically enable Wut by requiring it:

require 'wut'

Development

After cloning the repository, set up the environment:

bin/setup

Run the tests:

bundle exec rspec

Contributing

Contributions are welcome! Please submit bug reports and pull requests at GitHub.

License

This gem is available as open-source under the terms of the MIT License.