Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

console_hash_array

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

console_hash_array

  • 0.1.2
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source
# Console Hash Array

Console print progress bar for hash arrays.


Example

require 'console_hash_array'

groups = ConsoleHashArray.example()
groups.keys.each.with_index do | key, rindex |
    ConsoleHashArray.console( groups, rindex, nil, key, :left )
    groups[ key ].each.with_index do | item, cindex |
        ConsoleHashArray.console( groups, rindex, cindex, key, :right )
    end
end

# => 
# [0]  Nurwë                ..............................
# [1]  Legolas              ..............................
# [2]  Primrose Boffin      ..............................
# [3]  Aranuir              .......
# [4]  Ruby Gardner         ..............................
# [5]  Harding              ..............................
# [6]  Írimon               ..............................
# [7]  Torhir Ifant         ..............................
# [8]  Anairë               ..............................
# [9]  Golasgil             ..............................
# [10]  Mîm                 ..............................
# [11]  Tobold Hornblower   ..............
# [12]  Thrór               .....
# [13]  Gerda Boffin        ..............................



Table of Contents
  1. Quickstart
  2. Parameters
  3. Options
  4. Contributing
  5. Limitations
  6. License
  7. Code of Conduct
  8. Support my Work


Quickstart
require 'console_hash_array'

groups = ConsoleHashArray.example()
groups.keys.each.with_index do | key, rindex |
    ConsoleHashArray.console( groups, rindex, nil, key, :left )
    groups[ key ].each.with_index do | item, cindex |
        ConsoleHashArray.console( groups, rindex, cindex, key, :right )
    end
end


Setup

Add this line to your application's Gemfile:

gem console_hash_array

And then execute:

bundle install console_hash_array

Or install it yourself as:

gem install console_hash_array

On Rubygems:



Methods

.example()

require 'console_hash_array'

groups = ConsoleHashArray.example()

Return
Hash

.console()

require 'console_hash_array'

ConsoleHashArray.console( groups, rindex, cindex, key, :left )

Input

TypeRequiredDescription
groupsHash of ArraysYesFull Groups Hash
rindexIntYesSet row index for calculation and output options.
cindexInt:left = nil, :right = YesSet column index for calculation and output options.
keyString or SymbolYesSet current key from groups hash.
modeSymbolYesUse :left for initialization row, :right will update progres line
optionsHashNoChange default behaviour. See options for more informations.

Return
Hash (p)


Options

NrNameKeyDefaultTypeDescription
1Boxes Total:right__boxes_total30IntSet length of progres bar
2Spaces:style__spaces" "StringSet Character of space
3Steps:style__steps"."StringSet Character of steps
4Print Left:print__left"[{{rindex}}] {{key}} {{left__spaces}} "StringSet Structure for :left


Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/a6b8/console-hash-array-for-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.


Limitations

  • Build for development usage
  • No input validation

License

The gem is available as open source under the terms of the MIT License.


Code of Conduct

Everyone interacting in the console-hash-array-for-ruby project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.


Support my Work

Donate by https://www.paypal.com

FAQs

Package last updated on 21 Aug 2021

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc