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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/scope_methods.rb +9 -17
  3. metadata +5 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d39163dcffdba89ba0fb255c75759b401cc8c14f
4
- data.tar.gz: 9c5f2eb9a65416d77a96b65ff1e9673c271bb8e8
3
+ metadata.gz: 44c31ea12a17e08f89afbce2d28beaa97097dc0a
4
+ data.tar.gz: e385874767e1b8d7b6524cc515c86a707a04b2db
5
5
  SHA512:
6
- metadata.gz: d651305e029afca1d77c0c4596715826f5140737ecf12f1a67f8f568bb16c723c31159b99026acd7c91ead0cffa9c19cc47ed3afd7a64a87f3449814e1b668c7
7
- data.tar.gz: 3cb5a7c0198229bd8d102f75e647f3d5be580bdafbb6e3ad94ba98f3f283c1fbaec2bad14bb9d0f8fd3d8d1f7d8fe9828a3580d2ff1bc173fabe9273c82edef8
6
+ metadata.gz: a60f7554e68e8de6a4e12987704674b91f790fd112af4fcb8080b20ce739dda7198cbc2c017aaaec783a2638de805ad20a97728f56ad5a241f2f4111ca93ec83
7
+ data.tar.gz: 8267f939723911c4f3fca8abb45efdebab869e2f6d6ba46c0cb61d7251cca361d5cb2dc43d753ffd85910b0311eb0772fa362f981cc38b0609a5828115bcc57d
@@ -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? scope
21
- valid_month?(month(scope)) and valid_year?(year(scope))
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 scope
25
- scope[0..3].to_i
25
+ def year scope_value
26
+ scope_value.to_s[0..3].to_i
26
27
  end
27
28
 
28
- def month scope
29
- scope[-2, 2].to_i
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? 1900, 3000
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
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-10-23 00:00:00.000000000 Z
11
+ date: 2016-11-19 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: Easy handling of Brazilian's Ministry of Health files scopes (Year and
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: []