Hash#flatten

okkez e$B$G$9!#e(B

e$B%j%U%!%l%s%9%^%K%e%"%k$N:n6H$r$7$F$$$F5$$E$$$?$N$G$9$,!"e(BHash#flatten
e$B$NF0:n$,%3%a%s%H$He(B
e$B0[$J$C$F$$$k$h$&$G$9!#%3!<%I$NF0$-$K%3%a%s%H$r9g$o$;$k%Q%C%A$r=q$$$F$_$^$7$?!#e(B

Index: hash.c

— hash.c (revision 15977)
+++ hash.c (working copy)
@@ -1677,8 +1677,9 @@

  • level argument determines the level of recursion to flatten.
  • a =  {1=> "one", 2 => [2,"two"], 3 => "three"}
    
    • a.flatten    # => [1, "one", 2, [2, "two"], 3, "three"]
      
    • a.flatten(1) # => [1, "one", 2, [2, "two"], 3, "three"]
      
    • a.flatten(2) # => [1, "one", 2, 2, "two", 3, "three"]
      
    • a.flatten    # => [1, "one", 2, 2, "two", 3, "three"]
      
    */

static VALUE

okkez e$B$G$9!#e(B

e$B2?$+$b$N$9$4$$4*0c$$$r$7$F$$$?$$?$$$G$9!#e(B
e$B$9$
$^$;$s$,!"0J2<$N%Q%C%A$O<h$j2<$2$^$9!#e(B

e$B<+J,$G$b2?$r8+4V0c$($?$N$+$o$+$i$J$$e(Borz

08/04/11 e$B$Ke(B okkez[email protected] e$B$5$s$O=q$-$^$7$?e(B:

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs