scoppie 0.0.4 → 0.0.5
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 +9 -17
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44c31ea12a17e08f89afbce2d28beaa97097dc0a
|
4
|
+
data.tar.gz: e385874767e1b8d7b6524cc515c86a707a04b2db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a60f7554e68e8de6a4e12987704674b91f790fd112af4fcb8080b20ce739dda7198cbc2c017aaaec783a2638de805ad20a97728f56ad5a241f2f4111ca93ec83
|
7
|
+
data.tar.gz: 8267f939723911c4f3fca8abb45efdebab869e2f6d6ba46c0cb61d7251cca361d5cb2dc43d753ffd85910b0311eb0772fa362f981cc38b0609a5828115bcc57d
|
data/lib/scope_methods.rb
CHANGED
@@ -3,7 +3,7 @@ require 'date'
|
|
3
3
|
module ScopeMethods
|
4
4
|
include Comparable
|
5
5
|
|
6
|
-
module ClassMethods
|
6
|
+
module ClassMethods
|
7
7
|
|
8
8
|
def make_scope ayear, amonth
|
9
9
|
scope_string = Scope.build_scope_string ayear, amonth
|
@@ -17,16 +17,17 @@ module ScopeMethods
|
|
17
17
|
amonth < 10 ? "#{ayear}0#{amonth.to_i}" : "#{ayear}#{amonth.to_i}"
|
18
18
|
end
|
19
19
|
|
20
|
-
def valid?
|
21
|
-
|
20
|
+
def valid? scope_value
|
21
|
+
scope_value = scope_value.to_s
|
22
|
+
valid_month?(month(scope_value)) and valid_year?(year(scope_value))
|
22
23
|
end
|
23
24
|
|
24
|
-
def year
|
25
|
-
|
25
|
+
def year scope_value
|
26
|
+
scope_value.to_s[0..3].to_i
|
26
27
|
end
|
27
28
|
|
28
|
-
def month
|
29
|
-
|
29
|
+
def month scope_value
|
30
|
+
scope_value.to_s[-2, 2].to_i
|
30
31
|
end
|
31
32
|
|
32
33
|
def date_to_scope date
|
@@ -37,13 +38,12 @@ module ScopeMethods
|
|
37
38
|
Date.new(year(scope), month(scope))
|
38
39
|
end
|
39
40
|
|
40
|
-
private
|
41
41
|
def valid_month? month_in_number
|
42
42
|
month_in_number.between? 1, 12
|
43
43
|
end
|
44
44
|
|
45
45
|
def valid_year? year_in_number
|
46
|
-
year_in_number.between?
|
46
|
+
year_in_number.between? 2000, 3000
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
@@ -75,19 +75,11 @@ module ScopeMethods
|
|
75
75
|
Scope.date_to_scope date
|
76
76
|
end
|
77
77
|
|
78
|
-
def prior!
|
79
|
-
@value = self.prior
|
80
|
-
end
|
81
|
-
|
82
78
|
def next
|
83
79
|
date = Scope.scope_to_date(@value).next_month
|
84
80
|
Scope.date_to_scope date
|
85
81
|
end
|
86
82
|
|
87
|
-
def next!
|
88
|
-
@value = self.next
|
89
|
-
end
|
90
|
-
|
91
83
|
def to_i
|
92
84
|
@value.to_i
|
93
85
|
end
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scoppie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gedean Dias
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description: Easy handling of
|
14
|
-
Month)
|
13
|
+
description: Easy scope handling of brazilian's Ministry of Health files names (Year
|
14
|
+
and Month)
|
15
15
|
email: gedean.dias@gmail.com
|
16
16
|
executables: []
|
17
17
|
extensions: []
|
@@ -44,5 +44,5 @@ rubyforge_project:
|
|
44
44
|
rubygems_version: 2.6.2
|
45
45
|
signing_key:
|
46
46
|
specification_version: 4
|
47
|
-
summary: Scope Handler
|
47
|
+
summary: File name Scope Handler
|
48
48
|
test_files: []
|