hayeah / rubish

Ruby Interacive Shell
Other
60 stars 4 forks source link

Can't assign result of a command execution to a variable #1

Open sohocoke opened 13 years ago

sohocoke commented 13 years ago

It appears the result of an assignment of the results of a call to Command#map, ends up with the variable pointing to the Command, rather than the result Array.

parkan@xldn3743vdap:~$ irb -rrubish
>> Rubish.repl
> ls
archived_  Documents  logs     Movies    pkgs    src
bin        Downloads  mmt      Music     public  tmp
Desktop    Library    mob-dev  Pictures  Public  vpworkspace
> files = ls.map
["archived_",
 "bin",
 "Desktop",
 "Documents",
 "Downloads",
 "Library",
 "logs",
 "mmt",
 "mob-dev",
 "Movies",
 "Music",
 "Pictures",
 "pkgs",
 "public",
 "Public",
 "src",
 "tmp",
 "vpworkspace"]
> puts files
#<Rubish::Command:0x98e4c58 @args=[], @cmd="files", @quoted=false>
> files.class
Rubish::Command
> ls.map.class
Array
>