Method: Xf::Scope#set

Defined in:
lib/xf/scope.rb

#set(value = nil, &fn) ⇒ Proc[Hash] -

Sets a value in a Hash

Parameters:

  • (defaults to: nil)

    nil [Any]

    Value to set at the target

  • Block to yield target value to. Returned value will be set as the new value at the target.

Returns:

  • Hash] New Hash with transformation applied

Since:

  • 0.0.2



35
36
37
# File 'lib/xf/scope.rb', line 35

def set(value = nil, &fn)
  Proc.new { |hash| set_value(hash, value, &fn) }
end