LoginSignup
0
0

More than 1 year has passed since last update.

.values if is_a?

Posted at
  • source
a = ["apple", "bread", "cookie"]
ah = {"a":"apple", "b":"bread", "c":"cookie"}

def p_v(v)
  r = v.values if v.is_a?(Hash)
end

p p_v(a)
p p_v(ah)
  • result
nil
["apple", "bread", "cookie"]

Refs.

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0