
Security News
Astral Launches pyx: A Python-Native Package Registry
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
== HelperClasses
Some simple classes to help in everyday tasks
=== DPuts
Ever wanted to have detailed debug-output, but in the end even PRODUCING the string without printing it was too long? Here comes DPuts! It let's you define different debug-levels and the strings are only evaluated if they're about to be printed! Great for that 10MB-dump that you only want for debugging...
Usage:
include HelperClasses::DPuts
DEBUG_LVL = 5
dputs(5){ "String with some #{huge_db.inspect}" }
This will evaluate and print the huge_db
variable, while
include HelperClasses::DPuts
DEBUG_LVL = 4
dputs(5){ "String with some #{huge_db.inspect}" }
will NOT evaluate it! The debug-levels are arbitrarily chosen like this:
0 - Errors 1 - Info and warnings, important 2 - Often used debug-messages - limit of production-use 3 - More detailed debugging 4 5 - Dumping lots of raw data
==== Fine-grained debugging
If you have a function with lots of dputs in it, and you'd like to output all debugging messages just from that function, you simply add
dputs_func
at the beginning of your function.
If you want just one specific dputs to be evaluated, just change its name to ddputs:
DEBUG_LVL = 0
ddputs(5){"String with lots of data#{huge_var.inspect}"}
will be evaluated!
=== Arraysym
to_sym and to_sym! - calls .to_sym on all elements. Usage:
using HelperClasses::ArraySym
p [ "a", "b" ].to_sym
Produces "[ :a, :b ]"
=== HashAccessor
This should be standard ruby. Access all elements of an array by prepending a "_".
==== Getting a value
using HelperClasses::HashAccessor
p { :a => 2, "a" => 3 }._a
Will print "2". So symbols have precedence over string-keys.
==== Setting a value
using HelperClasses::HashAccessor
a = { :a => 2, "a" => 3 }
a._a = 4
a._b = 5
p a
Will print { :a => 4, "a" => 3, :b => "5" }
FAQs
Unknown package
We found that helper_classes demonstrated a not healthy version release cadence and project activity because the last version was released 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
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.
Security News
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.