Sha256: dc93a005a8d7cc74b12c417ff570a87904a1561588b6ca662dcea2d4a88416ce
Contents?: true
Size: 369 Bytes
Versions: 1
Compression:
Stored size: 369 Bytes
Contents
module WithOrder module HashExtraction def extract_hash_value(hash, key) return hash[key] if key.is_a?(Symbol) first_key, remaining_content = key.to_s.match(/^([^\[]+)(.*)$/).captures if remaining_content == '' hash[first_key] else eval "hash[first_key.to_sym]#{remaining_content} rescue nil" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
with_order-0.1.0 | lib/with_order/hash_extraction.rb |