p_inspect
Version, currently master branch1 version
- master branchlatestDec 4, 2016
github.com/paulcsmith/p_inspect.cr
Inspect crystal objects at runtime
Installation
# Add this to your shard.yml
dependencies:
p_inspect:
github: paulcsmith/p_inspect.cr
branch: mastermaster is a branch, not a release, so this tracks it rather than pinning a version.
Then run:
shards installshard.yml
- Crystal
0.19.4- License
- MIT
- Author
- Paul Smith
Dependencies
This version declares no dependencies.
README
p_inspect
Adds #p_inspect and .p_inspect to every object. This method prints the
object and returns self. This makes it so you can print anything without
having to refactor your code.
Some examples
Debugging things is tricky. Some people (like myself) like to print objects to see what they look like at runtime. The problem is you often need to change code to print things out.
Let's say we have some code like this where we want to see what the objects look like along the way.
string = "my-new-string"
.split("-")
.map { |word| word.upcase }
.join("")
Without p_inspect you'd need to break the code up like this
string = "my-new-string".split("-")
puts string
string = string.map { |word| word.upcase }
puts string
# ...etc.
With p_inspect print objects with minimal modifcation to your code
string = "my-new-string"
.split("-")
.p_inspect
.map { |word| word.upcase }
.p_inspect
.join("")
.p_inspect
Installation
Add this to your application's shard.yml:
dependencies:
p_inspect:
github: paulcsmith/p_inspect
Usage
require "p_inspect"
And then you can call p_inspect on object.
Contributing
- Fork it ( https://github.com/paulcsmith/p_inspect/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
Contributors
- paulcsmith Paul Smith - creator, maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This branch
- Branch
master- Seen
- Dec 4, 2016
- Crystal
0.19.4- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/paulcsmith/p_inspect.cr
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 15, 2026
- Synced
- Aug 15, 2026
- Versions
- 1