Home > Back-end >  Ruby class running methods
Ruby class running methods

Time:04-10

I have a Ruby Class with a method that basically runs a list of other methods inside the same Class. Eg:

def tidy
    delete_gallery_items
    delete_collections
    import_collections
    assign_albums_to_collections
    reorder_albums
    rebuild_gallery_items
    reposition_collections
end

Will these all run one after another or could there be a scenario when one of the later ones starts before a previous one has finished?

CodePudding user response:

One will be called after the other. It is not possible that a later one gets called before it is its turn.

I can only think of an edge case like that when those methods internally start new threads then a later method might process its thread faster than an earlier method. But that doesn't change the fact that the methods will be called one after the other.

  •  Tags:  
  • ruby
  • Related