Search code examples
ruby-on-railsrubyrmagick

Ruby and Rmagick. How to add ImageList to ImageList? Creating list of the lists


I am using Rmagick and Ruby 2.1.0

I have the following code:

@ilg = Magick::ImageList.new
@il = Magick::ImageList.new

# in the loop
_______________
pic = Magick::Image.read("#{@dir}/#{e}").first
@il.push(pic)
_______________

@ilg.push(@il.append(false))
@ilg.write("#{@dir}/results/result#{@counter}.jpg") 

I would like to replace 'pic' variable with Another ImageList.

I need something like this instead of @il.push(pic):

@il.push(@another_list.append(true))

How can I do it?


Solution

  • Like Малъ Скрылевъ said, ImageList is based on Enumerable. That means that you can just use @il += @list_being_added.