Class Origin::Smash
In: lib/origin/smash.rb
Parent: Hash

This is a smart hash for use with options and selectors.

Methods

[]   __deep_copy__   new  

Attributes

aliases  [R]  @attribute [r] aliases The aliases. @attribute [r] serializers The serializers.
serializers  [R]  @attribute [r] aliases The aliases. @attribute [r] serializers The serializers.

Public Class methods

Initialize the new selector.

@example Initialize the new selector.

  Origin::Smash.new(aliases, serializers)

@param [ Hash ] aliases A hash of mappings from aliases to the actual

  field names in the database.

@param [ Hash ] serializers An optional hash of objects that are

  responsible for serializing values. The keys of the hash must be
  strings that match the field name, and the values must respond to
  #localized? and #evolve(object).

@since 1.0.0

Public Instance methods

Get an item from the smart hash by the provided key.

@example Get an item by the key.

  smash["test"]

@param [ String ] key The key.

@return [ Object ] The found object.

@since 2.0.0

Perform a deep copy of the smash.

@example Perform a deep copy.

  smash.__deep_copy__

@return [ Smash ] The copied hash.

@since 1.0.0

[Validate]