scoppie 0.0.5 → 0.0.6

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
- SHA1:
3
- metadata.gz: 44c31ea12a17e08f89afbce2d28beaa97097dc0a
4
- data.tar.gz: e385874767e1b8d7b6524cc515c86a707a04b2db
2
+ SHA256:
3
+ metadata.gz: 485bd57c5b4da9582adfc393197db908b88accdb5b70a835714401c05da86bb4
4
+ data.tar.gz: '08a30d4d7425176a666389719e89cbb381ad6fcdd59cf2ea1e448ef8018d984e'
5
5
  SHA512:
6
- metadata.gz: a60f7554e68e8de6a4e12987704674b91f790fd112af4fcb8080b20ce739dda7198cbc2c017aaaec783a2638de805ad20a97728f56ad5a241f2f4111ca93ec83
7
- data.tar.gz: 8267f939723911c4f3fca8abb45efdebab869e2f6d6ba46c0cb61d7251cca361d5cb2dc43d753ffd85910b0311eb0772fa362f981cc38b0609a5828115bcc57d
6
+ metadata.gz: 0a9658ad30c4dd937cbb6a73a85f930a62f066d751c45064fb9ae93602a391e9ee6bbf5e36f9646c23ac62fce506d565464d51883c5f8c6640e7eb407e1c729d
7
+ data.tar.gz: 2c9a05a5e6ff15d93445d4b9341944dc400760b9411f0d8acd4eec3491638019b537eff5a67741046e1b645e98a632122374b9c8401f07987b0054085ca38411
data/README.md CHANGED
@@ -1,3 +1,7 @@
1
+ [![Code Climate](https://codeclimate.com/github/gedean/scoppie/badges/gpa.svg)](https://codeclimate.com/github/gedean/scoppie)
2
+
3
+ [![Build Status](https://snap-ci.com/gedean/scoppie/branch/master/build_image)](https://snap-ci.com/gedean/scoppie/branch/master)
4
+
1
5
  # Scoppie
2
6
 
3
7
  Easy handling of Brazilian's Ministry of Health files scopes (Year and Month)
data/lib/scope.rb CHANGED
@@ -8,7 +8,9 @@ class Scope
8
8
 
9
9
  def initialize value
10
10
  fail "Invalid Scope (#{value})" unless Scope.valid? value
11
- @value = value
11
+ @value = value.to_s
12
+ @value.freeze
12
13
  @short_value = get_short_value
14
+ @short_value.freeze
13
15
  end
14
16
  end
data/lib/scope_methods.rb CHANGED
@@ -91,8 +91,24 @@ module ScopeMethods
91
91
  def <=>(other)
92
92
  to_date <=> other.to_date
93
93
  end
94
+
95
+ def span(end_scope)
96
+ (end_scope = Scope.new(end_scope)) unless end_scope.is_a?(Scope)
97
+
98
+ raise "Current Scope (#{to_s}) bigger or equal to end scope (#{end_scope.to_s})" if (self >= end_scope)
99
+
100
+ scope_span = []
101
+ current_scope = Scope.new(to_s)
102
+
103
+ while current_scope <= end_scope
104
+ scope_span << current_scope
105
+ current_scope = current_scope.next
106
+ end
107
+ scope_span
108
+ end
109
+
110
+ private
94
111
 
95
- private
96
112
  def get_short_value
97
113
  raise "year (#{year}) shorten than #{MIN_ACCEPTED_YEAR}" if year < MIN_ACCEPTED_YEAR
98
114
  "#{year - 2000}#{month_to_s}"
data/lib/scoppie.rb CHANGED
File without changes
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scoppie
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
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-19 00:00:00.000000000 Z
11
+ date: 2019-10-20 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Easy scope handling of brazilian's Ministry of Health files names (Year
14
14
  and Month)
@@ -40,8 +40,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
42
  requirements: []
43
- rubyforge_project:
44
- rubygems_version: 2.6.2
43
+ rubygems_version: 3.0.4
45
44
  signing_key:
46
45
  specification_version: 4
47
46
  summary: File name Scope Handler