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

dotize

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dotize

  • 0.1.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Dotize

Travis build status

Access values from a deeply-nested Hash using a simple string:

my_hash = {'a' => {'b' => {'c' => 123}}}
my_hash.extend(Dotize)
my_hash.dot('a.b.c') # => 123

If a value isn't found, nil is returned by default:

my_hash.dot('a.b.z.z.z') # => nil

You can provide a block to override the default, like Ruby's Hash#fetch:

my_hash.dot('a.b.z.z.z') { |el| 2 + 2 } # => 4

Development

  • Run specs via rake or bundle exec rspec

Credits

The name of this is inspired-by copied from github.com/vardars/dotize, a Javascript equivalent.

FAQs

Package last updated on 09 Jan 2016

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