Class: Hash
- Defined in:
- lib/musa-dsl/core-ext/hashify.rb,
lib/musa-dsl/core-ext/inspect-nice.rb,
lib/musa-dsl/core-ext/inspect-nice.rb
Instance Method Summary collapse
-
#hashify(keys: , default: nil) ⇒ Hash
Filters and reorders hash to include only specified keys, preserving modules.
-
#inspect ⇒ String
Provides compact, readable inspect output with symbol-key shorthand.
-
#to_s ⇒ String
Aliases to_s to inspect for consistency.
Instance Method Details
#hashify(keys: , default: nil) ⇒ Hash
This method is added to Hash via refinement. Requires using Musa::Extension::Hashify.
Singleton class modules are preserved via DeepCopy.copy_singleton_class_modules
Filters and reorders hash to include only specified keys, preserving modules.
Creates a new hash with only the requested keys, in the order specified. Missing keys get nil (or default). Singleton class modules (like dataset extensions) are copied to the result.
189 |
# File 'lib/musa-dsl/core-ext/hashify.rb', line 189 class ::Hash; end |
#inspect ⇒ String
This method is added to Hash via refinement. Requires using Musa::Extension::InspectNice.
Provides compact, readable inspect output with symbol-key shorthand.
Symbol keys are displayed as key: value (Ruby 2.0+ syntax) instead of
:key => value. String/other keys use the fat arrow syntax.
75 |
# File 'lib/musa-dsl/core-ext/inspect-nice.rb', line 75 class ::Hash; end |
#to_s ⇒ String
This method is added to Hash via refinement. Requires using Musa::Extension::InspectNice.
Aliases to_s to inspect for consistency.
85 |
# File 'lib/musa-dsl/core-ext/inspect-nice.rb', line 85 class ::Hash; end |