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
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 |
# File 'lib/cli_helper.rb', line 285 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 |