Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Ruby
  3. Hashie

Hashie

MITRubyv5.1.0

A collection of Ruby classes and mixins that extend Hashes with powerful features like method access, coercion, and indifferent access.

GitHubGitHub
3.0k stars315 forks0 contributors

What is Hashie?

Hashie is a Ruby library that enhances the standard Hash class with a collection of extensions and subclasses. It solves the problem of rigid hash manipulation by adding features like method-style access, automatic type coercion, and deep nested operations, making hashes behave more like flexible objects.

Target Audience

Ruby developers working with complex hash data, such as API clients, configuration management, or data transformation layers, who need more expressive and less verbose hash handling.

Value Proposition

Developers choose Hashie because it provides a modular, mixin-based approach to extending hashes without monkey-patching, offering a wide range of utilities like Dash for structured data and Mash for pseudo-objects, all while staying lightweight and interoperable with existing Ruby code.

Overview

Hashie is a collection of classes and mixins that make Ruby hashes more powerful.

Use Cases

Best For

  • Adding method-style access and querying to configuration hashes
  • Automatically coercing API response data into typed Ruby objects
  • Creating structured data models with required fields and defaults using Dash
  • Building flexible, Rails-like indifferent access hashes for web parameters
  • Implementing deep merging and nested key lookups in complex data structures
  • Translating external API keys to internal Ruby conventions with Trash

Not Ideal For

  • Applications with strict performance requirements where the overhead of method_missing and dynamic key handling is unacceptable
  • Projects that require immutable data structures to prevent accidental mutations in shared data
  • Teams preferring explicit standard Ruby hash syntax to avoid hidden method conflicts and 'magic' behavior
  • Environments on older Ruby versions (pre-2.0) where symbol memory leaks are a concern, especially with symbolized keys

Pros & Cons

Pros

Flexible Method Access

Enables dot notation and query methods (e.g., hash.name?) for hash values, making code more readable and object-like without sacrificing hash functionality.

Modular Extensions

Allows mixing in only needed modules like Coercion or IndifferentAccess, providing a lightweight and composable way to enhance hashes without monkey-patching.

Deep Nested Operations

Offers deep_merge, deep_fetch, and deep_locate for easy manipulation and retrieval in complex nested hashes, useful for API responses or configuration data.

Structured Data Modeling

Dash subclass enforces defined properties with defaults, required fields, and custom validations, ideal for creating strict data models from external sources.

Cons

Method Conflict Warnings

Logs noisy warnings when keys conflict with existing methods (e.g., overriding 'zip'), requiring explicit disabling via disable_warnings or quiet mode.

Performance Overhead

Dynamic features like method_missing and PermissiveRespondTo add runtime cost—up to 20% slower initialization and setters—and can cause memory growth.

Complex Edge Cases

Handles non-symbolizable keys (e.g., numbers) inconsistently, and circular coercions require procedural workarounds, increasing setup complexity.

Frequently Asked Questions

Quick Stats

Stars3,038
Forks315
Contributors0
Open Issues25
Last commit1 month ago
CreatedSince 2009

Tags

#deep-merge#hacktoberfest#open-source#coercion#data-structures#ruby

Built With

R
Ruby

Included in

Ruby14.1k
Auto-fetched 6 hours ago

Related Projects

VirtusVirtus

[DISCONTINUED ] Attributes on Steroids for Plain Old Ruby Objects

Stars3,746
Forks231
Last commit5 years ago
HamsterHamster

Efficient, Immutable, Thread-Safe Collection classes for Ruby

Stars1,911
Forks92
Last commit4 years ago
AddressableAddressable

Addressable is an alternative implementation to the URI implementation that is part of Ruby's standard library. It is flexible, offers heuristic parsing, and additionally provides extensive support for IRIs and URI templates.

Stars1,611
Forks279
Last commit26 days ago
ActiveAttrActiveAttr

What ActiveModel left out

Stars1,196
Forks91
Last commit4 months ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub