Class Origin::Selector
In: lib/origin/selector.rb
Parent: Smash

The selector is a special kind of hash that knows how to serialize values coming into it as well as being alias and locale aware for key names.

Methods

[]=   merge!   store   to_pipeline  

Public Instance methods

[]=(key, value)

Alias for store

Merges another selector into this one.

@example Merge in another selector.

  selector.merge!(name: "test")

@param [ Hash, Selector ] other The object to merge in.

@return [ Selector ] The selector.

@since 1.0.0

Store the value in the selector for the provided key. The selector will handle all necessary serialization and localization in this step.

@example Store a value in the selector.

  selector.store(:key, "testing")

@param [ String, Symbol ] key The name of the attribute. @param [ Object ] value The value to add.

@return [ Object ] The stored object.

@since 1.0.0

Convert the selector to an aggregation pipeline entry.

@example Convert the selector to a pipeline.

  selector.to_pipeline

@return [ Array<Hash> ] The pipeline entry for the selector.

@since 2.0.0

[Validate]