From: "Jermaine O." Date: 2012-09-13T21:46:54+09:00 Subject: Re: ruby Range to array that acts like time objects? Hi Sung, (800..900).reject { |n| (n % 100) > 59 } is just what I need. Sweet! Thanks a bunch Sung Pae wrote in post #1075802: > On Thu, Sep 13, 2012 at 08:31:44PM +0900, Jermaine O. wrote: > >> instead of going all the way up to 99. > Do you just want to throw away values where the mod(100) values are > greater than 59? > > (800..900).reject { |n| (n % 100) > 59 } > # => [800, 801, 802, 803, …, 900] > > Or do you want to map base-10 numbers to a kind of untyped base-60 > format? > > (800..900).map { |n| (n / 60)*100 + (n % 60) } > # => [1320, 1321, 1322, 1323, 1324, 1325, 1326, 1327, 1328, 1329, > 1330, 1331, 1332, 1333, 1334, 1335, 1336, 1337, 1338, 1339, 1340, > 1341, 1342, 1343, 1344, 1345, 1346, 1347, 1348, 1349, 1350, 1351, > 1352, 1353, 1354, 1355, 1356, 1357, 1358, 1359, 1400, 1401, 1402, > 1403, 1404, 1405, 1406, 1407, 1408, 1409, 1410, 1411, 1412, 1413, > 1414, 1415, 1416, 1417, 1418, 1419, 1420, 1421, 1422, 1423, 1424, > 1425, 1426, 1427, 1428, 1429, 1430, 1431, 1432, 1433, 1434, 1435, > 1436, 1437, 1438, 1439, 1440, 1441, 1442, 1443, 1444, 1445, 1446, > 1447, 1448, 1449, 1450, 1451, 1452, 1453, 1454, 1455, 1456, 1457, > 1458, 1459, 1500] -- Posted via http://www.ruby-forum.com/.