sinatra-hexacta 0.9.12 → 1.0.0
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 235207ce86479d51ab5c1852a286ab92d5b4de8fbd159d584bc79234bcafd5dc
|
4
|
+
data.tar.gz: 933097a5eca58c05479cb29e93543c9e9ca292eb45c61b940be4ab9c4cf80f9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c57ec64f35c7f71a043278ffc15e8e131f53cc8a29dfcb353475baa4763a27b09e323eacb16c0f652b209eb44d22383f8e91096403e42e35cfd73f08c5ec10ef
|
7
|
+
data.tar.gz: 2bfb5b976a50e30124bce1b534953b68e4c95f7398b4d34dace6afee55204b32adaec6bf67ac892f2cd33554a048a4f98be171a0ad17ac72581ef19aa32b8e5e
|
@@ -5,16 +5,16 @@ class Antiquity
|
|
5
5
|
@periods = periods.sort { |a,b| a.start_date <=> b.start_date }
|
6
6
|
end
|
7
7
|
|
8
|
-
def days
|
9
|
-
@periods.inject(0) { |total, period| total + period.days }
|
8
|
+
def days(upto_date=Date.today)
|
9
|
+
@periods.inject(0) { |total, period| total + period.days(upto_date) }
|
10
10
|
end
|
11
11
|
|
12
|
-
def months
|
13
|
-
@periods.inject(0) { |total, period| total + period.months }
|
12
|
+
def months(upto_date=Date.today)
|
13
|
+
@periods.inject(0) { |total, period| total + period.months(upto_date) }
|
14
14
|
end
|
15
15
|
|
16
|
-
def years
|
17
|
-
months.divmod(12).first
|
16
|
+
def years(upto_date=Date.today)
|
17
|
+
months(upto_date).divmod(12).first
|
18
18
|
end
|
19
19
|
|
20
20
|
def to_s(upto_date=Date.today)
|
@@ -22,11 +22,13 @@ class Antiquity
|
|
22
22
|
result = ""
|
23
23
|
return result if @periods.empty?
|
24
24
|
if date >= @periods.first.start_date
|
25
|
-
|
26
|
-
|
27
|
-
result +=
|
28
|
-
result += "
|
29
|
-
result += "
|
25
|
+
years_upto_date = years(date)
|
26
|
+
months_upto_date = months(date)
|
27
|
+
result += years_upto_date > 1 ? "#{years_upto_date} años" : "#{years_upto_date} año" unless years_upto_date == 0
|
28
|
+
result += ", " if years_upto_date >= 1 && !(months_upto_date.modulo(12).eql?(0))
|
29
|
+
result += months_upto_date.modulo(12) > 1 ? "#{months_upto_date.modulo(12)} meses" : "#{months_upto_date.modulo(12)} mes" unless months_upto_date.modulo(12) == 0
|
30
|
+
result += "#{(date - @periods.last.start_date).to_i} dias" if months_upto_date.modulo(12) == 0 && years_upto_date == 0 && date > @periods.last.start_date
|
31
|
+
result += "Hoy!" if months_upto_date.modulo(12) == 0 && date == @periods.last.start_date
|
30
32
|
end
|
31
33
|
result += "En unos días..." if date < @periods.first.start_date
|
32
34
|
result
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-hexacta
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marco Zanger
|
@@ -163,7 +163,6 @@ files:
|
|
163
163
|
- lib/sinatra/public/vendors/malihu-custom-scrollbar-plugin/mCSB_buttons.png
|
164
164
|
- lib/sinatra/public/vendors/material-design-iconic-font/css/material-design-iconic-font.css
|
165
165
|
- lib/sinatra/public/vendors/material-design-iconic-font/css/material-design-iconic-font.min.css
|
166
|
-
- lib/sinatra/public/vendors/material-design-iconic-font/fonts/Material-Design-Iconic-Font.eot
|
167
166
|
- lib/sinatra/public/vendors/material-design-iconic-font/fonts/Material-Design-Iconic-Font.svg
|
168
167
|
- lib/sinatra/public/vendors/material-design-iconic-font/fonts/Material-Design-Iconic-Font.ttf
|
169
168
|
- lib/sinatra/public/vendors/material-design-iconic-font/fonts/Material-Design-Iconic-Font.woff
|