Class Hashie::Trash
In: lib/hashie/trash.rb
Parent: Dash

A Trash is a ‘translated’ Dash where the keys can be remapped from a source hash.

Trashes are useful when you need to read data from another application, such as a Java api, where the keys are named differently from how we would in Ruby.

Methods

[]=   property  

Public Class methods

Defines a property on the Trash. Options are as follows:

  • :default - Specify a default value for this property, to be

returned before a value is set on the property in a new Dash.

  • :from - Specify the original key name that will be write only.
  • :with - Specify a lambda to be used to convert value.
  • :transform_with - Specify a lambda to be used to convert value

without using the :from option. It transform the property itself.

Public Instance methods

Set a value on the Dash in a Hash-like way. Only works on pre-existing properties.

[Validate]