Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.ruby > #3390

Re: Can I check the a hash contain another hash in deep check?

From 7stud -- <bbxx789_05ss@yahoo.com>
Newsgroups comp.lang.ruby
Subject Re: Can I check the a hash contain another hash in deep check?
Date 2011-04-22 14:43 -0500
Organization Service de news de lacave.net
Message-ID <758c4aaf187411fc8e2eba4061c112d2@ruby-forum.com> (permalink)
References <8fbd65fb29171a781300613cbda0168f@ruby-forum.com>

Show all headers | View raw


Siratinee Sukachai wrote in post #994555:
> h = {'Member'=>{'number'=>{'name'=>'Name'}}}
>
> Can I check from the key which the value is also hashes?
> example:
>
> has_hash_value(h['Member']) = true/ false
>
> some kind like this... Can I?


h = {'Member'=>{'number'=>{'name'=>'Name'}}}

if h['Member'].instance_of?(Hash)
  puts 'yes'
end

--output:--
yes

-- 
Posted via http://www.ruby-forum.com/.

Back to comp.lang.ruby | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Can I check the a hash contain another hash in deep check? Siratinee Sukachai <ploy.sukachai@gmail.com> - 2011-04-22 13:52 -0500
  Re: Can I check the a hash contain another hash in deep check? 7stud -- <bbxx789_05ss@yahoo.com> - 2011-04-22 14:43 -0500

csiph-web