Symbol.all_symbols

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

e$B%j%U%!%l%s%9JT=8Cf$K5$$E$$$?$3$H$K$D$$$F$N<ALd$G$9!#e(B
Symbol.all_symbolse$B%a%=%C%I$N!"<0E83+$r4^$`%7%s%%k%j%F%i%ke(B
e$B$N07$$$,e(B1.8e$B$He(B1.9e$B$GJQ2=$7$F$$$k$N$G$9$,!"$3$l$O0U?^$7$?JQ99$G$7$g$&$+!#e(B

def number
‘mymake_bar’
end

p Symbol.all_symbols.select{|sym|sym.to_s.include? ‘mymake’}

:‘mymake_foo’
:"#{number}"

p Symbol.all_symbols.select{|sym|sym.to_s.include? ‘mymake’}
END
#=>
ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32]
[:mymake_foo]
[:mymake_bar, :mymake_foo]
#=>
ruby 1.9.0 (2007-09-24 patchlevel 0) [i386-mswin32_80]
[:mymake_foo]
[:mymake_foo]

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:31854] Symbol.all_symbols”
on Tue, 25 Sep 2007 15:09:58 +0900, eklerni
[email protected] wri
tes:

|e$B%j%U%!%l%s%9JT=8Cf$K5$$E$$$?$3$H$K$D$$$F$N<ALd$G$9!#e(B
|Symbol.all_symbolse$B%a%=%C%I$N!"<0E83+$r4^$`%7%s%%k%j%F%i%ke(B
|e$B$N07$$$,e(B1.8e$B$He(B1.9e$B$GJQ2=$7$F$$$k$N$G$9$,!"$3$l$O0U?^$7$?JQ99$G$7$g$&$+!#e(B

e$B$=$&$G$9$M!#e(B1.9e$B$G$O<B9T$5$l$J$$%7%s%%k<0$,:GE,2=$K$h$j:o$i$le(B
e$B$F$$$^$9!#%7%s%%k$r0u;z$7$?$jBeF~$7$?$j$9$k$H%7%s%%k$,:n$ie(B
e$B$l$^$9!#e(B

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

e$B$=$&$G$9$M!#e(B1.9e$B$G$O<B9T$5$l$J$$%7%s%%k<0$,:GE,2=$K$h$j:o$i$le(B
e$B$F$$$^$9!#%7%s%%k$r0u;z$7$?$jBeF~$7$?$j$9$k$H%7%s%%k$,:n$ie(B
e$B$l$^$9!#e(B

e$B$J$k$[$I!":GE,2=$N1F6A$G$9$+!#%7%s%%[email protected]@.$5$le(B
e$B$k$3$H$r3NG’$7$^$7$?!#e(B
e$B$"$j$,$H$&$4$6$$$^$9!#e(B

def number
‘mymake_bar’
end

p Symbol.all_symbols.select{|sym|sym.to_s.include? ‘mymake’}

:‘mymake_foo’
re = :"#{number}"

p Symbol.all_symbols.select{|sym|sym.to_s.include? ‘mymake’}
END
#=>
ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32]
[:mymake_foo]
[:mymake_bar, :mymake_foo]
#=>
ruby 1.9.0 (2007-09-24 patchlevel 0) [i386-mswin32_80]
[:mymake_foo]
[:mymake_foo, :mymake_bar]

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