versioned_blocks 1.0.2 → 1.0.3

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZTcxNjc5Y2FjMGE3MzYyZWYxNzc5Nzc5YjkzZmFkNjIzZjIyNDJiMg==
4
+ OTQwZGMyMzIyNTZmOGNkZWVjYmU0ZWE2YWY2MmJhZGU3NzRhMGJjYQ==
5
5
  data.tar.gz: !binary |-
6
- NjdjOTQ4NWQ3NWQ3NGY4MWI4YmU1ZmMxNDEyZDYyYWI2MDZhNDcyNg==
6
+ OTI2NTgyMWM4NDUzMDdjMzIxNTU1NmRhY2U1YTg4MWE3NGY1YTI1Nw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZTAxMTM5M2EwYjZjMmZiNmJlNWMyMWNmYzBhMGU4MGFlOTUwZDU3OTg0ZGUx
10
- MzEwYjJlYWExOGM0YzQwMzE4OWM0MDNiNGQwZjE3YjAwZjkwMzM0NDBlYTFm
11
- ZDdjMzc4MzNmMmJkMWY5NWZhZTFiNWU2MzgxYjkwMDc0NDdhMWQ=
9
+ OGNjZTgzNWRjN2Q2ZTEyYTE0YTdmNjRiOWFkZTMyYTM3MzViYTMyNDM1NjQ0
10
+ ZTI0MDdiMjIwMDk0MTU1ZTEzOGNiMTRmOTE4MzNlNmQ3MGUyNDhhYzRmODky
11
+ YjJiZWQ4MWJmNTBhYjhjYjNkMmE5MjA0MDFiODhjYjlkNDI3MmE=
12
12
  data.tar.gz: !binary |-
13
- OTc5YThmYmY3OTVmYTc0NjRkODM2OGViOWQ1YjFkZTdlNmZlMmFhZDk0ZTgx
14
- YzhkYzkxNTZiNDU1NWNhZmVkN2QxMWE3ODkzM2I3ODI1YzRhMzYzYjY3YWQx
15
- ZDcwNTkyZjJiOTI2ZGNhZDQ3N2VmYjcyY2MzYTkzZTIxMTA1YWY=
13
+ NmY1NTU1YTk4YThhYTljMWExMDJjYWM4NjBiNjhiYjE4NTk0NWEyZTBlYzNh
14
+ YzYxOWM5OTY4ODc3MzQxM2M4YzYxNTgwMDhjNWFmZDM4YWU5NmE5NjYwZWU2
15
+ ZDc3YjY2ZjBjMzBjN2I4MjUwMTliNTc0NzA3ZWNkMzU2Zjg0OTg=
@@ -1,5 +1,5 @@
1
1
  class VersionedBlocks
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
 
4
4
  class << self
5
5
  attr_accessor :versions, :base_uri, :prepend_errors
@@ -40,9 +40,9 @@ class VersionedBlocks
40
40
  # or reset the default versioning with:
41
41
  # VersionedRetry.reset
42
42
  opts = opts_specify_a_version?(opts) || (opts[:override]==true && opts_specify_a_version?(opts)) ? opts : self.versions
43
- #opts = self.versions unless (opts[:override]==true || self.versions == {})
43
+ raise VersionedBlocksException, "No versions specified!" if opts == {} || !opts_specify_a_version?(opts)
44
44
  if opts[:from].is_a?(Integer) && opts[:to].is_a?(Integer) # from vX to vY
45
- raise "Expected :from (#{opts[:from]}) to be less than :to (#{opts[:to]})" if opts[:from] > opts[:to]
45
+ raise VersionedBlocksException, "Expected :from (#{opts[:from]}) to be less than :to (#{opts[:to]})" if opts[:from] > opts[:to]
46
46
  versions_to_test = (opts[:from]..opts[:to])
47
47
  else
48
48
  if opts[:to].is_a?(Integer) # up to vX
@@ -53,10 +53,10 @@ class VersionedBlocks
53
53
  if opts[:these].all?{|n| n.is_a?(Integer)}
54
54
  versions_to_test = opts[:these]
55
55
  else
56
- raise "Each element in :these must be an integer"
56
+ raise VersionedBlocksException, "Each element in :these must be an integer"
57
57
  end
58
58
  else
59
- raise "Couldn't determine which versions to test!\nUse :only, :these, :to, or :from and :to"
59
+ raise VersionedBlocksException, "Couldn't determine which versions to test!\nUse :only, :these, :to, or :from and :to"
60
60
  end
61
61
  end
62
62
  versions_to_test
@@ -84,4 +84,7 @@ module Kernel
84
84
  end
85
85
  end
86
86
  end
87
+ end
88
+
89
+ class VersionedBlocksException < Exception
87
90
  end
@@ -43,7 +43,7 @@ describe 'Versioned Blocks' do
43
43
  versioned_block(from:@y, to:@x) {}
44
44
  expect(false).to be true
45
45
  rescue Exception=>e
46
- expect(e.class.to_s).to eq 'RuntimeError'
46
+ expect(e.class.to_s).to eq 'VersionedBlocksException'
47
47
  end
48
48
  end
49
49
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: versioned_blocks
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - devend711@gmail.com