grid-number 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/Changes +4 -0
  3. data/lib/grid.rb +12 -3
  4. metadata +2 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 07a08910f6014d347eeb2834b9b1324c4586adaa
4
- data.tar.gz: 19bb9330c758f451eebfefc2ffd8446e1ce875c3
3
+ metadata.gz: 81a1948d9b07246f629d878712114936467535c0
4
+ data.tar.gz: f1ddef604117a67aade85a42c93e0917cea955fe
5
5
  SHA512:
6
- metadata.gz: 29e04abcc90a31be8ff5400a9e6e935079014038331d21301171ce6ea34ab0e55aa751422624ffba8173d2bcab80e5d567ee748b3d6360e85376fd8b5b8ec423
7
- data.tar.gz: fbe0826f85d37b448f46198b9a07158983bc339ce1e5257ed65c11fe375eac60d0b3d4b72427f0fbefffb2e359dedb491db0be671d6f2817551a9fc65145dd6e
6
+ metadata.gz: a72aee3c96e9fe0024523cea84a3a4681a7a7df6c204015f9c76f5fd75040fe5ecbb7aaadd51fda3da9f2b9c3d1c0a05a94c6e1d87d4676c9b61590d1c42c781
7
+ data.tar.gz: 2893d5ecac39590167775b819015156c5a5de6e9995d82d8203861782cb471bb1f0378eeb9d744f2afda150128981aea5332e76db99947a6381e31e7b08b667e
data/Changes ADDED
@@ -0,0 +1,4 @@
1
+ 2018-04-08 v0.0.2
2
+ --------------------
3
+ * Added: Method #recalculate_check_character!
4
+ * Added: Ability to parse GRids with spaces
@@ -1,5 +1,5 @@
1
1
  class GRid
2
- VERSION = "0.0.1".freeze
2
+ VERSION = "0.0.2".freeze
3
3
 
4
4
  DEFAULT_ID_SCHEME = "A1".freeze
5
5
  CHECK_CODES = (("0".."9").to_a + ("A".."Z").to_a).freeze
@@ -53,7 +53,7 @@ class GRid
53
53
 
54
54
  # 2.5 has delete_prefix
55
55
  str[i, j] = ""
56
- str.sub!(/\A-/, "")
56
+ str.sub!(/\A[-\s+]/, "")
57
57
 
58
58
  val
59
59
  end
@@ -99,7 +99,7 @@ class GRid
99
99
  class_eval <<-METHOD, __FILE__, __LINE__ + 1
100
100
  def #{name}=(s)
101
101
  @#{name} = s
102
- @check_character = calculate_check_character
102
+ recalculate_check_character!
103
103
  @#{name}
104
104
  end
105
105
  METHOD
@@ -125,6 +125,15 @@ class GRid
125
125
  errors.empty?
126
126
  end
127
127
 
128
+ #
129
+ # Recalculate the GRid's check character.
130
+ # This is only necessary when an invalid check character is provided to the instance.
131
+ #
132
+ def recalculate_check_character!
133
+ @check_character = calculate_check_character
134
+ nil
135
+ end
136
+
128
137
  #
129
138
  # Create a Hash representing the GRid. Keys are Symbols representing the portions of the GRid.
130
139
  #
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grid-number
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Skye Shaw
@@ -63,6 +63,7 @@ extra_rdoc_files: []
63
63
  files:
64
64
  - ".gitignore"
65
65
  - ".travis.yml"
66
+ - Changes
66
67
  - Gemfile
67
68
  - LICENSE.txt
68
69
  - README.md