🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

visual_array

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

visual_array

1.1.0
Rubygems
Version published
Maintainers
1
Created
Source

RubyGems

The gem is available here VisualArrayGem

VisualArray

Description

VisualArray is a Ruby gem that displays arrays in a structured, visually appealing tabular format. It supports 1D, 2D, and multi-dimensional arrays with options for customizing text color.

Installation

Add this line to your application's Gemfile:

bundle add visual_array

Or install it manually:

gem install visual_array

Usage

Basic Example

require 'visual_array'

VisualArray.display([1, 2, 3, 4])

Output:

+---+---+---+---+
| 1 | 2 | 3 | 4 |
+---+---+---+---+

2D Array Example

VisualArray.display([
  [1, 2],
  [3, 4]
])

Output:

+-----+-----+
|  1  |  2  |
|  3  |  4  |
+-----+-----+

Multi-Dimensional Array Example

VisualArray.display([[[1, 2], [3, 4]], [[5, 6], [7, 8]]])

Output:

Dimension 1, Index 0:
+-----+-----+
|  1  |  2  |
|  3  |  4  |
+-----+-----+

Dimension 1, Index 1:
+-----+-----+
|  5  |  6  |
|  7  |  8  |
+-----+-----+

Customizing Color

You can pass optional color parameter:

VisualArray.display(
  [[[1, 2], [3, 4]], [[5, 6], [7, 8]]],
  color: 'blue'
)

Visual Representation

image

Development

After checking out the repo, run:

bin/setup

to install dependencies. Use bin/console for an interactive session.

To install this gem locally:

bundle exec rake install

To release a new version:

  • Update the version in version.rb.
  • Run:
bundle exec rake release

This will create a git tag, push commits, and publish the gem to RubyGems.

Contributing

Bug reports and pull requests are welcome at GitHub.

License

This project is available under the MIT License.

FAQs

Package last updated on 02 Mar 2025

Did you know?

Socket

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.

Install

Related posts