snails 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/snails/app.rb +13 -10
- data/snails.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73b2179dc09588501024d2f40012a2f4f538be71
|
4
|
+
data.tar.gz: d6f73300375ca16c07e84824cb9b09c79fc33cb2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a320924e476d05cfccf9507b7429ef663a8aa74a9c1fa9e0f9be7602802dc7f78cf786630342c656862c3a225e499917f8d235b9448e7da53f62021319e6786a
|
7
|
+
data.tar.gz: 57a030f3d034db98972a5d0b69af305243bdc6cd97babc06310a41c72dc5588d195a193fef365529eacbec4c1460277fc8f88ba0f845af7da0ad5ae7db626c87
|
data/lib/snails/app.rb
CHANGED
@@ -396,28 +396,31 @@ module Snails
|
|
396
396
|
|
397
397
|
module RelativeTime
|
398
398
|
|
399
|
-
def
|
400
|
-
|
401
|
-
return nil if minutes < 0
|
402
|
-
|
403
|
-
case minutes
|
399
|
+
def self.minutes_in_words(min)
|
400
|
+
case min
|
404
401
|
when 0..1 then 'menos de un min'
|
405
402
|
when 2..4 then 'menos de 5 min'
|
406
403
|
when 5..14 then 'menos de 15 min'
|
407
404
|
when 15..29 then "media hora"
|
408
|
-
when 30..59 then "#{
|
405
|
+
when 30..59 then "#{min} minutos"
|
409
406
|
when 60..119 then '1 hora'
|
410
407
|
when 120..239 then '2 horas'
|
411
408
|
when 240..479 then '4 horas'
|
412
409
|
when 480..719 then '8 horas'
|
413
410
|
when 720..1439 then '12 horas'
|
414
|
-
when 1440..11519 then "#{(
|
415
|
-
when 11520..43199 then "#{(
|
416
|
-
when 43200..525599 then "#{(
|
417
|
-
else "#{(
|
411
|
+
when 1440..11519 then "#{(min/1440).floor} días"
|
412
|
+
when 11520..43199 then "#{(min/11520).floor} semanas"
|
413
|
+
when 43200..525599 then "#{(min/43200).floor} meses"
|
414
|
+
else "#{(min/525600).floor} años"
|
418
415
|
end
|
419
416
|
end
|
420
417
|
|
418
|
+
def in_words
|
419
|
+
minutes = (((Time.now - self).abs)/60).round
|
420
|
+
return nil if minutes < 0
|
421
|
+
RelativeTime.minutes_in_words(minutes)
|
422
|
+
end
|
423
|
+
|
421
424
|
def relative
|
422
425
|
if str = in_words
|
423
426
|
if Time.now < self
|
data/snails.gemspec
CHANGED