get_room_list_from_blocks if self.blocks.nil? return [] elsif self.blocks.size <= 0 return [] else ret = [] for i in (0..self.blocks.size) rooms = self.blocks[i].rooms if rooms.size > 0 for j in (0..rooms.size) ret << b.rooms[j] end end end return ret end end
def get_room_list_from_blocks return [] if (self.blocks || []).empty? ret = [] for i in (0..self.blocks.size) rooms = self.blocks[i].rooms for j in (0..rooms.size) ret << b.rooms[j] end end return ret end
get_room_list_from_blocks return [] if (self.blocks || []).empty? ret = [] self.blocks.each do |b| rooms = b.rooms unless rooms.empty? rooms.each do |r| ret << r end end end return ret end
def get_room_list_from_blocks return [] if (self.blocks || []).empty? ret = [] bs = self.blocks.select(&:has_rooms?) bs.each do |b| b.rooms.each{|r| ret << r} end return ret end