scoppie 0.0.3 → 0.0.4
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/scope_methods.rb +11 -2
- 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: d39163dcffdba89ba0fb255c75759b401cc8c14f
|
4
|
+
data.tar.gz: 9c5f2eb9a65416d77a96b65ff1e9673c271bb8e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d651305e029afca1d77c0c4596715826f5140737ecf12f1a67f8f568bb16c723c31159b99026acd7c91ead0cffa9c19cc47ed3afd7a64a87f3449814e1b668c7
|
7
|
+
data.tar.gz: 3cb5a7c0198229bd8d102f75e647f3d5be580bdafbb6e3ad94ba98f3f283c1fbaec2bad14bb9d0f8fd3d8d1f7d8fe9828a3580d2ff1bc173fabe9273c82edef8
|
data/lib/scope_methods.rb
CHANGED
@@ -21,8 +21,6 @@ module ScopeMethods
|
|
21
21
|
valid_month?(month(scope)) and valid_year?(year(scope))
|
22
22
|
end
|
23
23
|
|
24
|
-
|
25
|
-
|
26
24
|
def year scope
|
27
25
|
scope[0..3].to_i
|
28
26
|
end
|
@@ -50,6 +48,8 @@ module ScopeMethods
|
|
50
48
|
end
|
51
49
|
|
52
50
|
module IntanceMethods
|
51
|
+
MIN_ACCEPTED_YEAR = 2000
|
52
|
+
|
53
53
|
def valid?
|
54
54
|
Scope.valid? @value
|
55
55
|
end
|
@@ -75,11 +75,19 @@ module ScopeMethods
|
|
75
75
|
Scope.date_to_scope date
|
76
76
|
end
|
77
77
|
|
78
|
+
def prior!
|
79
|
+
@value = self.prior
|
80
|
+
end
|
81
|
+
|
78
82
|
def next
|
79
83
|
date = Scope.scope_to_date(@value).next_month
|
80
84
|
Scope.date_to_scope date
|
81
85
|
end
|
82
86
|
|
87
|
+
def next!
|
88
|
+
@value = self.next
|
89
|
+
end
|
90
|
+
|
83
91
|
def to_i
|
84
92
|
@value.to_i
|
85
93
|
end
|
@@ -94,6 +102,7 @@ module ScopeMethods
|
|
94
102
|
|
95
103
|
private
|
96
104
|
def get_short_value
|
105
|
+
raise "year (#{year}) shorten than #{MIN_ACCEPTED_YEAR}" if year < MIN_ACCEPTED_YEAR
|
97
106
|
"#{year - 2000}#{month_to_s}"
|
98
107
|
end
|
99
108
|
end
|