class Origin::Smash

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

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

new(aliases = {}, serializers = {}) { |self| ... } click to toggle source

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

# File lib/origin/smash.rb, line 39
def initialize(aliases = {}, serializers = {})
  @aliases, @serializers = aliases, serializers
  yield(self) if block_given?
end

Public Instance Methods

__deep_copy__() click to toggle source

Perform a deep copy of the smash.

@example Perform a deep copy.

smash.__deep_copy__

@return [ Smash ] The copied hash.

@since 1.0.0

# File lib/origin/smash.rb, line 18
def __deep_copy__
  self.class.new(aliases, serializers) do |copy|
    each_pair do |key, value|
      copy.store(key, value.__deep_copy__)
    end
  end
end