Benign go Download

lib/colsole.rb

Ruby dynamically invokes a method with sendANSI erase-line/erase-screen sequence
SHA-256233051b8e45616f87be0195431d897fe066084b3933581c78760a79c1841ccf2
MaleculeH₂(DbU)

Evidence

English function-word token "for" lines 1–6
1require 'io/console'
2
3# Utility functions for colorful console applications.
4module Colsole
5 ANSI_COLORS = {
6 'n' => '', # no color …
English function-word token "that" lines 21–33
⋯5 lines
26 # Output a string with optional color markers to stdout.
27 # If text is ended with a white space, you can call again with replace: true
28 # to replace that line
29 def say(text, replace: false)
30 internal_say text, $stdout, replace: replace
31 end
32
33 …
English function-word token "the" lines 45–51
45:6… stream.tty?
46 end
47 end
48
49 # Returns true if the command exists in the path
50 def command_exist?(command)
51 ENV['PATH'].split(File::PATH_SEPAR …
ANSI erase-line/erase-screen sequence lines 124–131
124:5… d
125
126 def internal_say(text, stream, replace: false)
127 text = "\033[2K\r#{text}" if replace && terminal?
128 last = text[-1, 1]
129 handler = use_colors?(stream) ? :colorize : :strip_colors
130
131 if …
Ruby dynamically invokes a method with send lines 131–138
131:10… rminal? && ((last == ' ') || (last == '\t'))
132 stream.print send(handler, text)
133 else
134 stream.print send(handler, "#{text}\n")
⋯4 lines

Keyboard shortcuts on this page: j for the next sample, k for the previous one, x to go back to the feed, d to download the original bytes, r to re-queue the sample for analysis.