Method: Xf::Scope#get_value

Defined in:
lib/xf/scope.rb

#get_value(hash, &fn) ⇒ Any

Direct value getter, though it may be wiser to use Hash#dig here instead if you’re concerned about speed.

Parameters:

  • hash (Hash)

    Hash to get value from

Returns:

  • (Any)

Since:

  • 0.0.2



57
58
59
60
61
# File 'lib/xf/scope.rb', line 57

def get_value(hash, &fn)
  value = hash.dig(*@paths)

  block_given? ? fn[value] : value
end