SILENT KILLERPanel

Current Path: > > opt > alt > > ruby32 > share > ruby > syntax_suggest


Operation   : Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
Software     : Apache
Server IP    : 162.0.232.56 | Your IP: 216.73.216.111
Domains      : 1034 Domain(s)
Permission   : [ 0755 ]

Files and Folders in: //opt/alt//ruby32/share/ruby/syntax_suggest

NameTypeSizeLast ModifiedActions
capture Directory - -
api.rb File 5281 bytes April 24 2025 07:53:46.
around_block_scan.rb File 7067 bytes April 24 2025 07:53:46.
block_expand.rb File 4991 bytes April 24 2025 07:53:46.
capture_code_context.rb File 6826 bytes April 24 2025 07:53:46.
clean_document.rb File 8947 bytes April 24 2025 07:53:46.
cli.rb File 3190 bytes April 24 2025 07:53:46.
code_block.rb File 2179 bytes April 24 2025 07:53:46.
code_frontier.rb File 5752 bytes April 24 2025 07:53:46.
code_line.rb File 6615 bytes April 24 2025 07:53:46.
code_search.rb File 3908 bytes April 24 2025 07:53:46.
core_ext.rb File 3076 bytes April 24 2025 07:53:46.
display_code_with_line_numbers.rb File 1812 bytes April 24 2025 07:53:46.
display_invalid_blocks.rb File 1795 bytes April 24 2025 07:53:46.
explain_syntax.rb File 2465 bytes April 24 2025 07:53:46.
left_right_lex_count.rb File 4156 bytes April 24 2025 07:53:46.
lex_all.rb File 1145 bytes April 24 2025 07:53:46.
lex_value.rb File 1540 bytes April 24 2025 07:53:46.
parse_blocks_from_indent_line.rb File 1536 bytes April 24 2025 07:53:46.
pathname_from_message.rb File 1454 bytes April 24 2025 07:53:46.
priority_engulf_queue.rb File 1295 bytes April 24 2025 07:53:46.
priority_queue.rb File 2046 bytes April 24 2025 07:53:46.
ripper_errors.rb File 837 bytes April 24 2025 07:53:46.
scan_history.rb File 2991 bytes April 24 2025 07:53:46.
unvisited_lines.rb File 705 bytes April 24 2025 07:53:46.
version.rb File 76 bytes April 24 2025 07:53:46.

Reading File: //opt/alt//ruby32/share/ruby/syntax_suggest/display_code_with_line_numbers.rb

# frozen_string_literal: true

module SyntaxSuggest
  # Outputs code with highlighted lines
  #
  # Whatever is passed to this class will be rendered
  # even if it is "marked invisible" any filtering of
  # output should be done before calling this class.
  #
  #   DisplayCodeWithLineNumbers.new(
  #     lines: lines,
  #     highlight_lines: [lines[2], lines[3]]
  #   ).call
  #   # =>
  #       1
  #       2  def cat
  #     > 3    Dir.chdir
  #     > 4    end
  #       5  end
  #       6
  class DisplayCodeWithLineNumbers
    TERMINAL_HIGHLIGHT = "\e[1;3m" # Bold, italics
    TERMINAL_END = "\e[0m"

    def initialize(lines:, highlight_lines: [], terminal: false)
      @lines = Array(lines).sort
      @terminal = terminal
      @highlight_line_hash = Array(highlight_lines).each_with_object({}) { |line, h| h[line] = true }
      @digit_count = @lines.last&.line_number.to_s.length
    end

    def call
      @lines.map do |line|
        format_line(line)
      end.join
    end

    private def format_line(code_line)
      # Handle trailing slash lines
      code_line.original.lines.map.with_index do |contents, i|
        format(
          empty: code_line.empty?,
          number: (code_line.number + i).to_s,
          contents: contents,
          highlight: @highlight_line_hash[code_line]
        )
      end.join
    end

    private def format(contents:, number:, empty:, highlight: false)
      string = +""
      string << if highlight
        "> "
      else
        "  "
      end

      string << number.rjust(@digit_count).to_s
      if empty
        string << contents
      else
        string << "  "
        string << TERMINAL_HIGHLIGHT if @terminal && highlight
        string << contents
        string << TERMINAL_END if @terminal
      end
      string
    end
  end
end

SILENT KILLER Tool