Module: CLIHelper::HashWithSearch
- Defined in:
- lib/cli_helper.rb
Overview
Hash with search
Instance Method Summary collapse
-
#dsearch(path) ⇒ Object
Search inside path.
Instance Method Details
#dsearch(path) ⇒ Object
Search inside path
437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 |
# File 'lib/cli_helper.rb', line 437 def dsearch(path) stems = path.split('/') hash = self stems.delete_if {|s| s.nil? || s.empty? } stems.each do |stem| if hash.is_a? Hash if hash[stem] hash = hash[stem] else hash = nil break end else hash = nil break end end hash end |