in Education by
first..sorry for my poor english and my big noob question..the problem is... I need create a little shoes app than show the excel files inside a folder (this is only a part)...I define a method like this: def show_proov files = Dir.new(personal_folder).entries xlsxfiles = files.find_all {|file| file.include?('.xlsx') }.map do |file| file.scan(/^\w+/) end end if I show in a alert it..it works and shows the files...so far so good: now..the problem is than I wish iterate over this names and create a menu..when I try it I get a error related about "bad encode" (sorry but I've tried recreate this code but I never get this message again) well..no problem...maybe a list_box could do the work: inside my shoes app I define list_box :items => show_proov doing that..nothing is render inside the windows...don't show anything the same happen if I use @items=show_proov #@items.class = array list_box :items => @items it hasn't much sense but I must has the try... thanks for read and for help!! :D JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
I think your problem might be that your show_proov function is returning an array of arrays. [["file1"], ["file2"], ["file3"]] This is because String.scan returns an array. Try adding .first, like so: xlsxfiles = files.find_all {|file| file.include?('.xlsx') }.map do |file| file.scan(/^\w+/).first end Then the result will be: ["file1", "file2", "file3"]

Related questions

0 votes
    As the title suggests, I'm just looking for a way of pressing a button in Shoes without clicking ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 18, 2022 in Education by JackTerrance
0 votes
    This is what I have so far: myArray.map!{ rand(max) } Obviously, however, sometimes the numbers ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 23, 2022 in Education by JackTerrance
0 votes
    In Ruby, Dir.glob("**/*.rb") (for instance) doesn't traverse symlinked directories. Is it ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 11, 2022 in Education by JackTerrance
0 votes
    I declare steps that need to be done in order to install wordpress in an array in the beginning of ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Aug 1, 2022 in Education by JackTerrance
0 votes
    This question exist only because of pure curiosity. Not a homework. Find the fastest way to find two ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 20, 2022 in Education by JackTerrance
0 votes
    Let's say I have one variable, directory_list, which I define and set in a ruby_block named get_directory_list. Can ... woohoo" end end Select the correct answer from above options...
asked Feb 8, 2022 in Education by JackTerrance
0 votes
    I am an absolute beginner in this field. I have written the following code but it's not working. ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 28, 2022 in Education by JackTerrance
0 votes
    I am an absolute beginner in this field. I have written the following code but it's not working. ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 28, 2022 in Education by JackTerrance
0 votes
    I am an absolute beginner in this field. I have written the following code but it's not working. ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 28, 2022 in Education by JackTerrance
0 votes
    So I have a for loop that I want to output a new line in a textview every single time it goes ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 10, 2022 in Education by JackTerrance
0 votes
    I am trying to figure out a way to use the StringFormat class to add new line to a given TreeNode ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 7, 2022 in Education by JackTerrance
0 votes
    Why text inside / list is not affected (color of "item1", "item2" is not changed) by CSS applied ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 1, 2022 in Education by JackTerrance
0 votes
    Why text inside / list is not affected (color of "item1", "item2" is not changed) by CSS applied ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 29, 2022 in Education by JackTerrance
0 votes
    Why text inside / list is not affected (color of "item1", "item2" is not changed) by CSS applied ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 26, 2022 in Education by JackTerrance
0 votes
    I made some input boxes with 0 20px padding placeholders. However the text I type inside ignores padding ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 16, 2022 in Education by JackTerrance
...